How to fix "Could not load file or assembly 'msshrtmi.dll' ... when you are using .NET 4.5 and Windows Azure 1.8 SDK
vIf you started to work with Windows Azure SDK 1.8 on a .NET 4.5 projects, maybe you received the following error message:
The solution is pretty simple, but can give you a lot of headaches until you find what the problem is. The code is okay; you didn’t make any kind of mistake. You only need to change some configurations from app.config.
You will need to add “useLegacyV2RuntimeActivationPolicy” attribute to the startup node and set it to true. This flat notifies the .NET framework that you have dependencies to older API and make them run in the older runtime.
Next step is to disable “NetFx40_LegacySecurityPolicy”. In this way you notify the runtime not to use legacy CAS (Code Access Security) policy.
You’re configuration file should look something like this:
The type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.
…
{"Could not load file or assembly 'msshrtmi.dll' or one of its dependencies. A dynamic link library (DLL) initialization routine failed. (Exception from HRESULT: 0x8007045A)":"msshrtmi.dll"}
This problem usually appears in a console or desktop application when you are trying to use storage service from Windows Azure (blobs, tables or queues).The solution is pretty simple, but can give you a lot of headaches until you find what the problem is. The code is okay; you didn’t make any kind of mistake. You only need to change some configurations from app.config.
You will need to add “useLegacyV2RuntimeActivationPolicy” attribute to the startup node and set it to true. This flat notifies the .NET framework that you have dependencies to older API and make them run in the older runtime.
Next step is to disable “NetFx40_LegacySecurityPolicy”. In this way you notify the runtime not to use legacy CAS (Code Access Security) policy.
You’re configuration file should look something like this:
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<NetFx40_LegacySecurityPolicy enabled="false" />
</runtime>
These are the steps that need to be done to get rid of this execution.
Comments
Post a Comment