本文介绍了如何解决 Windows Azure 诊断运行时错误(无法创建 WindowsAzure.Diagnostics、Version=xx、Culture=neutral、PublicKeyToken=xx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

privateLibManager libManager;
private LibManager Connect()
{
   this.libManager=new LibManager();//here we are getting an error
}

错误:

'SWConfigDataClientLib.LibManager' 的类型初始值设定项引发异常

The type initializer for 'SWConfigDataClientLib.LibManager' threw an exception

内部异常:

无法创建 Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics,Version=2.2.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35.

Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics,Version=2.2.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35.

来源

IpPbxCDSClientLib

IpPbxCDSClientLib

推荐答案

首先确保您已从 SDK 文件夹(通常为 c:Program FilesMicrosoftSDKsWindows Azure.NET SDKv2.2efMicrosoft.WindowsAzure.Diagnostics.dll)

First make sure you have added references to Microsoft.WindowsAzure.Diagnostics from the SDK folders (typically c:Program FilesMicrosoft SDKsWindows Azure.NET SDKv2.2efMicrosoft.WindowsAzure.Diagnostics.dll)

接下来,如果您没有在模拟器中运行您的项目(即设置为启动项目的云项目),则将跟踪过滤器级别设置为TraceEventType.ErrorTraceEventType.无 以避免尝试将详细的 Azure 消息写入跟踪侦听器.在您的网络或应用配置中:

Next, if you are not running your project in the emulator (i.e. the cloud project set as the startup project), then set the trace filter level to TraceEventType.Error or TraceEventType.None to avoid trying to write verbose Azure messages to the trace listener. In you web or app config:

  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
          <filter level="TraceEventType.Error" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>

这篇关于如何解决 Windows Azure 诊断运行时错误(无法创建 WindowsAzure.Diagnostics、Version=xx、Culture=neutral、PublicKeyToken=xx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-18 20:34