I have Azure WebJobs methods registered as below
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)
{
...
}
I checked the code samples below: https://learn.microsoft.com/en-us/dotnet/api/overview/azure/microsoft.azure.webjobs.extensions.servicebus-readme-pre
And could not find a difference.
I am using following nuget packages:
- https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.ServiceBus/ https://www.nuget.org/packages/Azure.Messaging.ServiceBus/
I am getting following error:
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.).
Am I missing something here?
though Its too late. still I would like to answer this so it will be helpful in future. Today, I faced the same error and I tried to compare the changes. one thing I notice was we shouldn't have the parameter to get the message properties such as enqueuedtime, delivery count, message body, etc. instead these are already available in ServiceBusReceivedMessage message. so below piece throws error at runtime, with the parameter
and this one works fine. without properties param