.NET Core是否支持Web套接字?引发" System.Net.WebSockets.WebSocketException异常 [英] Is web socket supported in .NET Core ? throwing "System.Net.WebSockets.WebSocketException exception

查看:788
本文介绍了.NET Core是否支持Web套接字?引发" System.Net.WebSockets.WebSocketException异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.NET 核心2.1 .

I have written console application using .NET Core 2.1.

此应用程序的责任是:连接到

The responsibility of this application is: Connect to the Azure IoT hub and send data.

我仍然低于例外情况

System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server ---> System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure. at System.Net.Security.SslState.StartSendAuthResetSignal

注意:

Note:

  • 在Windows 10中正常工作
  • I am running my code on Windows 7 compact OS device.
  • Using web sockets
  • Works fine in Windows 10

这是我的裸露引用

   using Microsoft.Azure.Devices.Client;
   using Microsoft.Azure.Devices.Shared;

This is how I create connection.

   string deviceConnectionString = "*******";
  _Client = DeviceClient.CreateFromConnectionString(deviceConnectionString, TransportType.Mqtt_WebSocket_Only);

网络套接字在Windows 7上将无法使用.参考:

web sockets will not work on windows 7. Reference: Using WebSocket on Windows 7

因此,我正在使用.NET Core 2.1获得Web套接字支持,如此处所述

So I am using .NET Core 2.1 to get web socket support, as mentioned here https://github.com/dotnet/corefx/issues/20191

我仍然遇到相同的错误!

Still I get the same error!

以下是什么意思?

The remote certificate is invalid according to the validation?


非常感谢Deepak


Many Thanks Deepak

推荐答案

Hi,

您是否正在遵循教程或示例代码?您检查过该存储库了吗?

Were you following a tutorial or sample code? Have you checked this repository?

关于

Alberto Vega

Alberto Vega


这篇关于.NET Core是否支持Web套接字?引发" System.Net.WebSockets.WebSocketException异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆