Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0

We are using Azure SDK 1.8 and it working fine on local. we are using TFS hosted build controller to deploy on azure.

It was working fine before but sudden today we getting this error although we have no azure sdk dll version changed but online we get this error. Is this because of TFS build controller upgraded with new sdk? and strange thing this build is showing successful every time.

In TFS build service I found this strange stuff why it is referencing to v2.0 sdk. enter image description here

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
like image 957
SOF User Avatar asked May 31 '13 18:05

SOF User


2 Answers

If everything else fails, and the correct DLL is deployed in the bin, try adding an assembly binding redirect in the web.config:

<dependentAssembly>
  <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" />
  <bindingRedirect oldVersion="2.0.0.0" newVersion="1.8.0.0" />
</dependentAssembly>

Change the binding version numbers as needed.

like image 163
Dragos Durlut Avatar answered Nov 17 '22 00:11

Dragos Durlut


This happened to me because I updated the references from 2.0 to 2.2 but I still had the version 2.0 dll referenced in my web config:

<system.diagnostics>
<trace autoflush="true">
  <listeners>
    <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
      <filter type="" />
    </add>
  </listeners>
</trace>

like image 7
Lukos Avatar answered Nov 16 '22 23:11

Lukos