我在 StackOverflow 和其他网站上的其他几个线程中读到过有关此问题的信息。其他解决方案都没有解决我的问题,而且大多数都已经过时,引用了旧版本的 Azure SDK。
我有一个部署到 Azure 的典型 Azure 网站角色,该角色使用Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener
记录跟踪消息。当跟踪发生时,看起来好像DiagnosticMonitorTraceListener
正在使用RoleEnvironment
类,它又尝试加载显然不存在的msshrtmi.dll
。以下是记录到 Azure 文件系统的堆栈跟踪的一部分:
[FileNotFoundException: Could not load file or assembly 'msshrtmi, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment() +0
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor() +747
[TypeInitializationException: The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.get_IsAvailable() +0
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +23
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34
[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +9004943
System.Diagnostics.TypedElement.BaseGetRuntimeObject() +110
System.Diagnostics.ListenerElement.GetRuntimeObject() +989
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +252
System.Diagnostics.TraceInternal.get_Listeners() +331
System.Diagnostics.TraceInternal.WriteLine(String message) +161
Microsoft.WindowsAzure.AzureApplicationSettings..ctor() +437
Microsoft.WindowsAzure.CloudConfigurationManager.get_AppSettings() +137
Microsoft.WindowsAzure.CloudConfigurationManager.GetSetting(String name) +27
TankSoft.EverMarket.EverMarketPrereleaseRole.Endpoints.Api.Notify..ctor() +40
lambda_method(Closure , Object[] ) +60
Autofac.Core.Activators.Reflection.ConstructorParameterBinding.Instantiate() +315
各种线程都提到了我需要如何从 bin 文件夹中清除此 DLL,但该 DLL 一开始就没有被复制。我怀疑这与我在 Azure SDK 2.2 而不是 1.x 下运行有关。我意识到我可以直接引用 DLL,但我觉得我不必这样做才能将一个非常正常的项目部署到 Azure。为什么 Microsoft 没有自动检测我的项目需要此文件并为我部署正确的文件?这太令人抓狂了。
我还要说一下,我正在发布的项目是不是云服务而是一个常规的 Azure 网站项目。
有没有人运行 Azure SDK 2.x设法解决这个问题?您具体执行了哪些步骤?