question

NikolayRenziglov-9001 avatar image
0 Votes"
NikolayRenziglov-9001 asked ·

Blazor Client-side. Is it possible to access the Serial ports (COM) from browser?

Hi there
Is it possible to communicate to a Serial ports of a client machine making use of Blazor Client?
If yes, any clue or links?
Thanks

dotnet-aspnet-core-blazor
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

miwan2-msft avatar image
0 Votes"
miwan2-msft answered ·

Hi, @NikolayRenziglov-9001,

Blazor WebAssembly doesn't support to access local serial port on client. You will get the error below.

68498-image.png

It's danger and illegal for accessing the serial port from client side. You could try another approach:

  1. Write a Windows Service (I assume your machine runs Windows), configure it with necessary privileges. You will have to install something on the machine anyway. The service can be implemented in any language.

  2. Add HTTP(S) server capabilities to it and choose communication protocol over HTTP. You could use JSON, Ajax, WebSockets, SignalR, etc.
    · Send data byte from serial port to /.
    · Recieve command byte from serve to serial port .

  3. Build a web server to process the data with client.

  4. Create a front page to display your data and control it.




If the answer doesn’t solve your issue, please provide more details of error that will help us track down what’s happening.
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Best Regards,
Michael Wang



image.png (50.6 KiB)
image.png (73.5 KiB)
·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.