【发布时间】:2021-09-04 21:47:12
【问题描述】:
我使用 Visual Studio 模板创建了一个全新的 .NET Core 3.1 Azure Function 项目
我正在使用V3的功能,即模板创建的版本
我有最新的 VS - 16.10.2
直接失败,ServiceBusTrigger 和 Connection not found?
使用系统; 使用 Microsoft.Azure.WebJobs; 使用 Microsoft.Azure.WebJobs.Host; 使用 Microsoft.Extensions.Logging;
namespace AzureFunctionTest
{
public static class Function1
{
[FunctionName("Function1")]
public static void Run([ServiceBusTrigger("AzureFunctionTest", "Research Subscription", Connection = "eventbus-connection")]string mySbMsg, ILogger log)
{
log.LogInformation($"C# ServiceBus topic trigger function processed message: {mySbMsg}");
}
}
}
真的很奇怪,MS 本身的模板是如何不起作用的,而且有点担心这在第一关就失败了!!
这是我的项目文件的相关部分
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.1.2" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.11" />
</ItemGroup>
Azure.Messaging.ServiceBus 似乎是最新的包,也是推荐使用的包
我错过了什么?
保罗
【问题讨论】:
标签: c# azure azure-functions azureservicebus