因此,我将 CloudFX 与 Azure 的 SDK 2.0 一起使用。当我在控制台应用程序中的 Azure 环境(云或模拟器)之外运行我的工作角色时,一切都很顺利。
当我尝试使用模拟器或云时,我收到了带有以下信息的 AggregateException:
{"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()
所以我试图让这个程序集重定向但没有成功:
<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>
似乎 CloudFX 仍然有界/引用 SDK 1.8。谁能帮我们解决这个问题?
谢谢!