从 Azure 函数将消息写入 Azure 服务总线队列
Writing message to Azure Service Bus queue from Azure function
我正在尝试从 azure 函数向 azure 消息队列添加消息。为此,我正在关注这篇文章,其中我添加了对 Microsoft.Azure.ServiceBus 的引用。
尝试添加此引用时,Visual Studio 2017 中的 Azure 函数项目抱怨 Newtonsoft.Json (=9.0.1) 相对于 Microsoft.NET.Sdk.Functions 引用的受限版本。
Version conflict detected for Newtonsoft.Json. Install/reference
Newtonsoft.Json 10.0.1 directly to project IHA.Functions to resolve
this issue. IHA.Functions -> Microsoft.Azure.ServiceBus 3.1.0 ->
System.IdentityModel.Tokens.Jwt 5.2.2 -> Newtonsoft.Json (>= 10.0.1)
IHA.Functions -> Microsoft.NET.Sdk.Functions 1.0.14 -> Newtonsoft.Json
(=
9.0.1). IHA.Functions C:\TFS\IHA\Misc\IHA.CSL\IHA.Functions\IHA.Functions.csproj 1
据我了解,Microsoft.Azure.ServiceBus 需要 Newtonsoft.Json 10.0.1。如果我删除 9.0 版本并添加 10.0 版本,我可以成功添加 Microsoft.Azure.ServiceBus 包,但是 Azure Functions 项目会抱怨 Microsoft.NET.Sdk.Functions 需要 Newtonsoft 的 9.0。
基于这些理解,我似乎无法从 Azure 函数写入 Azure 消息队列。这是正确的还是我做错了什么?
Azure Functions 以扩展的形式明确支持服务总线。
您需要安装扩展程序,请参阅 Azure Service Bus bindings for Azure Functions。请注意您使用的是哪个 Function App 版本:1.x 使用完整的 .NET Framework,或测试版 2.x 使用 .NET Standard,并遵循相应的指导。
然后,您可以定义并写入 output binding.
,而不是直接使用服务总线 SDK
我正在尝试从 azure 函数向 azure 消息队列添加消息。为此,我正在关注这篇文章,其中我添加了对 Microsoft.Azure.ServiceBus 的引用。
尝试添加此引用时,Visual Studio 2017 中的 Azure 函数项目抱怨 Newtonsoft.Json (=9.0.1) 相对于 Microsoft.NET.Sdk.Functions 引用的受限版本。
Version conflict detected for Newtonsoft.Json. Install/reference Newtonsoft.Json 10.0.1 directly to project IHA.Functions to resolve this issue. IHA.Functions -> Microsoft.Azure.ServiceBus 3.1.0 -> System.IdentityModel.Tokens.Jwt 5.2.2 -> Newtonsoft.Json (>= 10.0.1)
IHA.Functions -> Microsoft.NET.Sdk.Functions 1.0.14 -> Newtonsoft.Json (= 9.0.1). IHA.Functions C:\TFS\IHA\Misc\IHA.CSL\IHA.Functions\IHA.Functions.csproj 1
据我了解,Microsoft.Azure.ServiceBus 需要 Newtonsoft.Json 10.0.1。如果我删除 9.0 版本并添加 10.0 版本,我可以成功添加 Microsoft.Azure.ServiceBus 包,但是 Azure Functions 项目会抱怨 Microsoft.NET.Sdk.Functions 需要 Newtonsoft 的 9.0。
基于这些理解,我似乎无法从 Azure 函数写入 Azure 消息队列。这是正确的还是我做错了什么?
Azure Functions 以扩展的形式明确支持服务总线。
您需要安装扩展程序,请参阅 Azure Service Bus bindings for Azure Functions。请注意您使用的是哪个 Function App 版本:1.x 使用完整的 .NET Framework,或测试版 2.x 使用 .NET Standard,并遵循相应的指导。
然后,您可以定义并写入 output binding.
,而不是直接使用服务总线 SDK