I have read about this problem on several other threads both on StackOverflow and other sites. None of the other solutions have solved my problem and most are outdated, referencing old versions of the Azure SDK.
I have a typical Azure website role deployed to Azure that uses Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener
to log trace messages. When tracing occurs, it appears as though DiagnosticMonitorTraceListener
is using the RoleEnvironment
class, which in turn tries to load the apparently non-existent msshrtmi.dll
. Here is a portion of the stack trace that is being logged to the file system in 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
Various threads have mentioned how I need to clean this DLL from my bin folder, but the DLL is not being copied in the first place. I suspect this has to do with me running under Azure SDK 2.2 and not 1.x. I realize I can reference the DLL directly but I feel that I should not have to do this in order to deploy what is a quite normal project to Azure. Why is Microsoft not automatically detecting that my project requires this file and deploying the correct file for me? This is maddening.
Let me also say that the project I am publishing is not a Cloud Service but rather a regular Azure website project.
Has anyone running Azure SDK 2.x managed to solve this issue? What were the exact steps you followed?
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.dll
Copy 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With