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

后端 未结 7 1627
抹茶落季
抹茶落季 2020-12-30 21:31

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.InvalidOper         


        
相关标签:
7条回答
  • 2020-12-30 21:58

    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.

    0 讨论(0)
  • 2020-12-30 22:01

    Downgrading from .net 4.6.1 to 4.6 seems to prevent the issue from occurring.

    0 讨论(0)
  • 2020-12-30 22:09

    As outlined in this answer above, the snippet below does the trick

    <runtime>
        ...
        <AppContextSwitchOverrides value="Switch.System.DisableMultipleDNSEntriesInSANCertificate=true" />
        ...
    <runtime>
    

    BUT be carefull to add it to the correct project in your solution! Add it to the project containing the Azure code and Azure references.

    0 讨论(0)
  • 2020-12-30 22:10

    The answer marked as solution, is not the solution, it is a botched job. The solution to use it in .Net Framework 4.6.1 is to add in the rutime block in App.config:

    <AppContextSwitchOverrides value="Switch.System.IdentityModel.DisableMultipleDNSEntriesInSANCertificate=true" />
    

    Read this article Mitigation: X509CertificiateClaimSet.FindClaims Method

    Very IMPORTANT for now Azure WebApps / WebJob etc, doesn't support 4.6.1 I will note here when (said at jan 21, 2016).

    It means, that you can develop a web job application with 4.6.1, but when you push it to Azure, you can see exceptions like Job failed due to exit code -2146232576

    0 讨论(0)
  • 2020-12-30 22:16

    For me it started failing after I updated .NET Framework from 4.5.2 to 4.7 All I did to fix it was update the Nuget Package WindowsAzure.ServiceBus to 5.2.0

    0 讨论(0)
  • 2020-12-30 22:22

    Today, I ran into this issue and had no idea about it. Finally, I decided to upgrade all the Azure nuget packages that I am using (including webjobs, servicebus ...) and BOOM! it WORKS. Hopefully, it will help if anyone runs into this issue in the future

    0 讨论(0)
提交回复
热议问题