1
votes

I have created an Azure Function (V2, .NETCore) for Service Bus Queue Trigger. But I am getting below error while running the project.Please find below the screenshots.

local.settings.json

Error-1

Error-2

My Function Code is given below.

using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace FunctionTriggers
{
    public static class Function1
    {
        [FunctionName("Function1")]
        public static void Run([ServiceBusTrigger("myqueue", Connection = "ServiceBusConnString")]string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
        }
    }
}
1
Could you please check if you have provided the right service bus connecting string? Regarding how to get it, please refer to docs.microsoft.com/en-us/azure/service-bus-messaging/…Jim Xu
@JimXu : I have added the correct connection string in local.settings.jsonuser12462814
Could you please provide your local.settings.json?Jim Xu
@JimXu: I have updated question with screenshots of local.settings.json and one more error for reference.user12462814
According to the picture you provide, the value of ServiceBusConnString is also the storage account connection string. Please use service bus connection string. It should be like Endpoint=sb://<your service bus name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<your share key>. Regarding how to get it, please refer to docs.microsoft.com/en-us/azure/service-bus-messaging/…Jim Xu

1 Answers

2
votes

If you want to use the Azure function service bus trigger, we must provide the Service Bus ConnString. The connection string should be like Endpoint=sb://<your service bus name>.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=<your share key>. Regarding how to get it, please refer to https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quickstart-portal#get-the-connection-string.