Search code examples
azureazureservicebusazure-webjobsazure-servicebus-queuesazure-webjobssdk

Azure WebJobs ServiceBus returns Exception: found 2 DNS claims in authorization context


I'm trying to read a message from an Azure ServiceBus queue using an Azure WebJob but it's throwing and exception:

Unhandled Exception: System.InvalidOperationException: Found 2 DNS claims in authorization context.

I've set the correct connection strings named "AzureWebJobsServiceBus", "AzureWebJobsDashboard" and "AzureWebJobsStorage"

The WebJob Program code has been updated to use JobHostConfiguration:

class Program
{
    static void Main()
    {
        var config = new JobHostConfiguration();
        config.UseServiceBus();

        var host = new JobHost(config);
        host.RunAndBlock();
    }
}

And the actual Job method

public class Functions
{
    public async static Task ServiceBusResizeRequest(
         [ServiceBusTrigger("blah")] string message,             
         TextWriter log
         )
    {            
        await log.WriteLineAsync("got message " + message);
    }

}

I can successfully create and write to the queue via a separate console application.

But when I run the webjob application, it throws that exception.

Any ideas?

EDIT: Using .net 4.6.1


Solution

  • January 29th Microsoft released version 3.1.3 of the NuGet package WindowsAzure.ServiceBus.

    From the release notes:

    • General: .Net 4.6.1+ compatibility fix. Fixing custom DNS IdentityVerifier so that we honor multiple DNS claims returned by WIF

    Upgrading the package solved the problem for us.