Open yuzhupeng opened 3 years ago
log:
{ "system": "Meowv.Blog", "datetime": "2021-02-24 23:00:24,733", "description": "binance:System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Action1.BeginInvoke(T obj, AsyncCallback callback, Object object) at WebSocketSharp.WebSocket.open() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 1554 at WebSocketSharp.WebSocket.Connect() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 3235 at GetTradeHistoryData.binanceWebscoket.Start(String senddata) in C:\Users\Administrator\Desktop\chenxu\GetTradeHistoryData\Futures\BINANCE\binanceWebscoket.cs:line 104", "level": "ERROR", "info": "" } { "system": "Meowv.Blog", "datetime": "2021-02-24 23:00:25,725", "description": ":System.PlatformNotSupportedException: Operation is not supported on this platform. at System.Action
1.BeginInvoke(T obj, AsyncCallback callback, Object object)
at WebSocketSharp.WebSocket.open() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 1554
at WebSocketSharp.WebSocket.Connect() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 3235
at GetTradeHistoryData.binanceUSDWebscoket.Start(String senddata) in C:\Users\Administrator\Desktop\chenxu\GetTradeHistoryData\Futures\BINANCE\binanceUSDWebscoket.cs:line 101", "level": "ERROR", "info": "" }
{ "system": "Meowv.Blog", "datetime": "2021-02-24 23:02:03,656", "description": "binancewebsocket_Closed", "level": "ERROR", "info": "" }
{ "system": "Meowv.Blog", "datetime": "2021-02-24 23:02:04,049", "description": "binancewebsocket_Closed", "level": "ERROR", "info": "" }
{ "system": "Meowv.Blog", "datetime": "2021-02-24 23:03:08,490", "description": ":System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Action`1.BeginInvoke(T obj, AsyncCallback callback, Object object)
at WebSocketSharp.WebSocket.open() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 1554
at WebSocketSharp.WebSocket.Connect() in C:\Users\Administrator\Desktop\chenxu\websocket-sharp\WebSocket.cs:line 3235
at GetTradeHistoryData.binanceWebscoket.Start(String senddata) in C:\Users\Administrator\Desktop\chenxu\GetTradeHistoryData\Futures\BINANCE\binanceWebscoket.cs:line 104", "level": "ERROR", "info": "" }
Are you by chance using .NET Core? I noticed that this issue is specifically related to the fact this project wasn't compiled against Core. I have no problems using .NET Standard.
I have this too in .NET 5 WPF
Same here. Winforms, after migrating from .NET Framework to .NET 5.
Switched to the latest NuGet of WebSocket4Net - is similar to code and works just fine.
I had this line in my old code:
Websocket.SslConfiguration.ServerCertificateValidationCallback = (sender, cert, chain, sslPolicyErrors) => { return true; };
Do you know if there is a WebSocket4Net analog?
One workaround is to use Connect
instead of ConnectAsync
and Send
instead of SendAsync
and if that doesn't work for you switch to https://github.com/sipsorcery/websocket-sharp
With a .Net6 project, I used Close
instead of CloseAsync
and no longer had this error. Using Connect
and Send
as well, thanks to @henon.
Operation is not supported on this platform. ???what problem