PlatformNotsupportedException在Glazor WebAssembly中带有Azure IoT Hub
我正在探索大火WebAssembly
。我正在移植WPF应用程序来评估功能。该应用程序正在连接到Azure IoT Hub
实例。
这是似乎有问题的代码部分:
var iotHubConnectionStringBuilder = IotHubConnectionStringBuilder.Create("HostName=<iotHubConnectionString>");
var registryManager = RegistryManager.CreateFromConnectionString(iotHubConnectionStringBuilder.ToString());
当调用create fromConnectionsTring
时,提出了以下例外:
Unhandled Exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.Http.SocketsHttpHandler.get_SslOptions()
at Microsoft.Azure.Devices.HttpClientHelper.CreateDefaultHttpMessageHandler(IWebProxy webProxy, Uri baseUri, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.HttpClientHelper.CreateDefaultClient(IWebProxy webProxy, Uri baseUri, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.HttpClientHelper..ctor(Uri baseAddress, IAuthorizationHeaderProvider authenticationHeaderProvider, IReadOnlyDictionary`2 defaultErrorMapping, TimeSpan timeout, IWebProxy customHttpProxy, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.RegistryManager..ctor(IotHubConnectionProperties connectionProperties, HttpTransportSettings transportSettings)
at Microsoft.Azure.Devices.RegistryManager.CreateFromConnectionString(String connectionString, HttpTransportSettings transportSettings)
at Microsoft.Azure.Devices.RegistryManager.CreateFromConnectionString(String connectionString)
问题
为什么会丢弃此错误?如何将其修复?
更新
令人惊讶的是,i Encounter“> Encounter”> Encounter“>该程序的MAUI版本也有类似的问题。
I am exploring Blazor Webassembly
. I am porting a WPF application to evaluate the functionalities. The application is connecting to an Azure IoT Hub
instance.
Here is the section of code that seems problematic:
var iotHubConnectionStringBuilder = IotHubConnectionStringBuilder.Create("HostName=<iotHubConnectionString>");
var registryManager = RegistryManager.CreateFromConnectionString(iotHubConnectionStringBuilder.ToString());
When calling CreateFromConnectionString
, the following exception is thrown:
Unhandled Exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Net.Http.SocketsHttpHandler.get_SslOptions()
at Microsoft.Azure.Devices.HttpClientHelper.CreateDefaultHttpMessageHandler(IWebProxy webProxy, Uri baseUri, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.HttpClientHelper.CreateDefaultClient(IWebProxy webProxy, Uri baseUri, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.HttpClientHelper..ctor(Uri baseAddress, IAuthorizationHeaderProvider authenticationHeaderProvider, IReadOnlyDictionary`2 defaultErrorMapping, TimeSpan timeout, IWebProxy customHttpProxy, Int32 connectionLeaseTimeoutMilliseconds)
at Microsoft.Azure.Devices.RegistryManager..ctor(IotHubConnectionProperties connectionProperties, HttpTransportSettings transportSettings)
at Microsoft.Azure.Devices.RegistryManager.CreateFromConnectionString(String connectionString, HttpTransportSettings transportSettings)
at Microsoft.Azure.Devices.RegistryManager.CreateFromConnectionString(String connectionString)
Question
Why is this error thrown and how can it be fixed?
Update
Surprisingly, I encounter a similar issue in the MAUI version of the program as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论