我已经在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
Run Code Online (Sandbox Code Playgroud)
各种线程已经提到我需要如何从我的bin文件夹中清除这个DLL,但是首先没有复制DLL.我怀疑这与我在Azure SDK 2.2下运行而不是1.x有关.我意识到我可以直接引用DLL,但我觉得我不应该这样做,以便将一个非常正常的项目部署到Azure.为什么Microsoft不会自动检测到我的项目需要此文件并为我部署正确的文件?这令人抓狂.
我还要说,我发布的项目不是Cloud Service,而是一个常规的Azure网站项目.
运行Azure SDK 2.x的任何人都设法解决了这个问题吗?您遵循的具体步骤是什么?
This feels like a hack but it was the only way I could think of to solve this issue.
C:\Program Files\Microsoft SDKs\Windows Azure\.NET SDK\v2.2\bin\runtimes\base\x64\msshrtmi.dllCopy Local on the new reference to True
EDIT: I ended up removing the code that was checking RoleEnvironment; instead, I'm relying on Web.config/App.config transforms to modify behavior at runtime. This removes the dependency on msshrtmi.dll.
| 归档时间: |
|
| 查看次数: |
14125 次 |
| 最近记录: |