Socket Exceptions when trying to connect to MySql database from gitpod IDE (ubuntu server)

前端 未结 1 581
孤独总比滥情好
孤独总比滥情好 2021-01-28 14:04

I\'m working with the gitpod online IDE ( vs code in the browser with an ubuntu linux server behind it). I\'m struggling with creating a Connection to my mysql database on an ot

相关标签:
1条回答
  • 2021-01-28 14:33

    From the call stack, it looks like you're compiling your code to wasm using Blazor. This code is running in the browser and is subject to all the limitations of the browser sandbox. More specifically, there is no ability in a browser to open a TCP socket for network communication.

    Some more background info is here:

    Blazor is running in the browser sandbox and cannot do more than javascript can network wise. So technically this is not possible.

    And here:

    TCP networking APIs that can't ever work in the browser, since JavaScript doesn't expose raw TCP networking capabilities. This naturally leads to a runtime failure from somewhere low in the stack.

    That is why you are getting a PlatformNotSupportedException.

    To fix this, you would need to rearchitect your code so that the MySQL connection is made from code running on a web server, and the Blazor code makes a HTTP request (to a web API) to invoke server-side code that performs the database operation.

    0 讨论(0)
提交回复
热议问题