Domanda

So, I'm using CloudFX with SDK 2.0 of Azure. Everything went well when I run my worker role outside Azure environment(neither cloud or emulator) in a console App.

When I'm trying to on Emulator or Cloud, I got an AggregateException with this info:

{"The type initializer for 'Microsoft.Experience.CloudFx.Framework.Diagnostics.TraceManager' threw an exception."}
Could not load file or assembly 'Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.Experience.CloudFx.Framework.Diagnostics.HybridTraceEventProvider..ctor(String providerName, Guid providerGuid)
   at Microsoft.Experience.CloudFx.Framework.Diagnostics.TraceManager.<>c__DisplayClass1.<Create>b__0(Guid guid)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.Experience.CloudFx.Framework.Diagnostics.TraceManager.Create(String providerName, Guid providerGuid)
   at Microsoft.Experience.CloudFx.Framework.Diagnostics.TraceManager..cctor()

So I've tried to make this assembly redirect without success:

<dependentAssembly>
      <assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>

Seems that CloudFX still bounded/references SDK 1.8. Can anyone please help us with this problem?

Thanks!

È stato utile?

Soluzione

With some help of a MSFT guy, Valery, I was able to fix this problem by double checking my configs making sure that nothing is pointing to version 1.8.0.0 and I have the assemblyBinding redirect config added.

While we dont have the new version of CloudFX release with the support to Azure SDK 2.0, all you need to do is add manually in the config this redirect at runtime/assemblyBinding/ section:

<dependentAssembly>
      <assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics" publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
    </dependentAssembly>

And that Azure-specific trace listener called AzureDiagnostics explicitly pointing to Microsoft.WindowsAzure.Diagnostics version=2.0.0.0

With it you should be able to use CloudFX with Azure SDK 2.0.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top