如何为IOTHUB提供运输处理程序?
我正在尝试连接到Iothub以配备设备。
我在一个大风WASM应用程序中。
我已经创建了安全提供商对称密钥:
SecurityProvider symmetricKeyProvider = new SecurityProviderSymmetricKey(parameters.DeviceId, parameters.DeviceSymmetricKey, null);
但是我要调用的下一行:
ProvisioningTransportHandler mqttTransportHandler = new ProvisioningTransportHandlerMqtt(TransportFallbackType.TcpOnly);
我已经尝试了TCPonly后备,并且没有传递任何后备,并且都给了我同样的错误。例外是:
Error provisioning device: The type initializer for 'Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt' threw an exception.
System.TypeInitializationException: The type initializer for 'Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt' threw an exception.
---> System.InvalidOperationException: failed to create a child event loop.
---> System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Threading.Thread.Start()
at DotNetty.Common.Concurrency.SingleThreadEventExecutor..ctor(IEventExecutorGroup parent, String threadName, TimeSpan breakoutInterval, IQueue`1 taskQueue)
at DotNetty.Common.Concurrency.SingleThreadEventExecutor..ctor(IEventExecutorGroup parent, String threadName, TimeSpan breakoutInterval)
at DotNetty.Transport.Channels.SingleThreadEventLoop..ctor(IEventLoopGroup parent, String threadName, TimeSpan breakoutInterval)
at DotNetty.Transport.Channels.SingleThreadEventLoop..ctor(IEventLoopGroup parent)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup.<>c.<.cctor>b__24_0(IEventLoopGroup group)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor(Func`2 eventLoopFactory, Int32 eventLoopCount)
--- End of inner exception stack trace ---
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor(Func`2 eventLoopFactory, Int32 eventLoopCount)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor()
at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt..cctor()
I am trying to connect to IoTHub to provision my device.
I am in a Blazor WASM app.
I have created the Security Provider Symmetric Key via:
SecurityProvider symmetricKeyProvider = new SecurityProviderSymmetricKey(parameters.DeviceId, parameters.DeviceSymmetricKey, null);
However my next line I call:
ProvisioningTransportHandler mqttTransportHandler = new ProvisioningTransportHandlerMqtt(TransportFallbackType.TcpOnly);
I have tried it with both the TcpOnly fallback along with not passing in any fallback and both give me the same error. The exception is:
Error provisioning device: The type initializer for 'Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt' threw an exception.
System.TypeInitializationException: The type initializer for 'Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt' threw an exception.
---> System.InvalidOperationException: failed to create a child event loop.
---> System.PlatformNotSupportedException: Operation is not supported on this platform.
at System.Threading.Thread.Start()
at DotNetty.Common.Concurrency.SingleThreadEventExecutor..ctor(IEventExecutorGroup parent, String threadName, TimeSpan breakoutInterval, IQueue`1 taskQueue)
at DotNetty.Common.Concurrency.SingleThreadEventExecutor..ctor(IEventExecutorGroup parent, String threadName, TimeSpan breakoutInterval)
at DotNetty.Transport.Channels.SingleThreadEventLoop..ctor(IEventLoopGroup parent, String threadName, TimeSpan breakoutInterval)
at DotNetty.Transport.Channels.SingleThreadEventLoop..ctor(IEventLoopGroup parent)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup.<>c.<.cctor>b__24_0(IEventLoopGroup group)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor(Func`2 eventLoopFactory, Int32 eventLoopCount)
--- End of inner exception stack trace ---
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor(Func`2 eventLoopFactory, Int32 eventLoopCount)
at DotNetty.Transport.Channels.MultithreadEventLoopGroup..ctor()
at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerMqtt..cctor()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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