我注册了 Azure WebJobs 方法,如下所示
Program.cs
hostBuilder.ConfigureWebJobs(webJobsBuilder =>
{
webJobsBuilder
.AddTimers()
.AddAzureStorageCoreServices()
.AddAzureStorageQueues()
.AddAzureStorageBlobs()
.AddServiceBus();
});
UserFunctions.cs
[FunctionName("SendRegisteredUserVerificationEmailsServiceBusTrigger")]
public async Task SendRegisteredUserVerificationEmailsServiceBusTrigger([ServiceBusTrigger(BookStoreServiceBusQueueNames.RegisteredUsers, Connection = "AzureWebJobsServiceBusConnectionString", IsSessionsEnabled = false)] Int32 deliveryCount,
DateTime enqueuedTimeUtc, ServiceBusReceivedMessage message, ServiceBusMessageActions messageActions)
{
...
}
我检查了下面的代码示例: https ://docs.microsoft.com/en-us/dotnet/api/overview/azure/microsoft.azure.webjobs.extensions.servicebus-readme-pre
并且找不到区别。
我正在使用以下 nuget 包:
- https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/ https://www.nuget.org/packages/Azure.Messaging.ServiceBus/
我收到以下错误:
InvalidOperationException: Cannot bind parameter 'message' to type
ServiceBusReceivedMessage. Make sure the parameter Type is supported by the binding.
If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make
sure you've called the registration method for the extension(s) in your startup code (e.g.
builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
我在这里错过了什么吗?