asp.net - Azure - 将数据从 IoT 中心发送到 Web 应用程序后端

标签 asp.net azure azure-web-app-service azure-iot-hub read-data

我正在寻找一种解决方案,将数据从 Azure IoT 中心获取到同样托管在 Azure 中的 Web 应用程序的后端,该应用程序是用 ASP.NET 4.6 编写的。 最好尽快接收原始 Json 字符串。

我发现其他人建议使用 Webhooks 或 Azure 函数来实现类似的目的,但这些解决方案带来的延迟确实令人无法接受。 最好直接连接到物联网端点并获取收到的每条消息。任何人都可以为我指出正确的方向吗?

最佳答案

您只需在 Web 应用程序中使用 EventHub .NET SDK,连接到 EventHub-compatible endpoint IoT 中心的并直接使用应用程序中的事件。这具有最小的延迟并且不涉及额外的组件。

如何指导(.NET core,但同样适用于.NET Framework):https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send#receive-events

var eventProcessorHost = new EventProcessorHost(
            EventHubName,
            PartitionReceiver.DefaultConsumerGroupName,
            EventHubConnectionString,
            StorageConnectionString,
            StorageContainerName);

// Registers the Event Processor Host and starts receiving messages
await eventProcessorHost.RegisterEventProcessorAsync<SimpleEventProcessor>();

关于asp.net - Azure - 将数据从 IoT 中心发送到 Web 应用程序后端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57031694/

相关文章:

javascript - 如何在页面上动态显示: Make ASP.网络标签

azure - 将 Azure 策略定义部署到管理组权限

c# - 将 C# 控制台应用程序发布为 Azure Web 作业

javascript - 如何从 Azure Javascript 应用服务中的脚本访问表

Azure 应用服务 - 从表 Controller 更新对象

azure - 无法从 Azure Web 应用程序 Azure AD 身份验证向 Azure API 授权

asp.net - 在 ASP.NET 3.5 中生成媒体 RSS (MRSS) 提要

c# - 禁止 asp :Literal from outputing HTML

azure - 为什么在发布我的 API 应用程序后,我收到 "A route named ' swagger_docs' is already in the Route Collection”?

javascript - 将 javascript 代码移动到设计 View 不起作用。仅代码隐藏 Attributes.Add ("onclick"有效。困惑