19

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)
SOF User
  • 7,590
  • 22
  • 75
  • 121
  • If you get something like this again, I highly recommend enabling the remote desktop feature and debugging on the box. It's dirty but debugging with a dev applcation, event viewer and the web config you can tweak the bindings until the versions match. – Phil Cooper Dec 19 '13 at 10:46

5 Answers5

22

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.

Dragos Durlut
  • 8,018
  • 10
  • 47
  • 62
  • Great It works. but I don't understand what happened. why this was required. – SOF User May 31 '13 at 23:31
  • Glad I could help. I wasted half a day trying to figure it out. I have no more runtime errors, but the (console application) autoscaler still doesn't autoscale. I guess in this case it's Nuget's fault. – Dragos Durlut Jun 03 '13 at 06:59
  • 1
    With these errors it is good to check the nuget packages being used in the project. If somebody for example updates some Azure related nuget package to newer version it might contain a reference to version 2.0.0 assemblies. – Juha Palomäki Jul 22 '13 at 11:34
  • 1
    Just used this snippet to fix a problem that spontaneously started occurring in a production Azure environment. Redirected 0.0.0.0-2.3.0.0 to 2.3.0.0. – Matthew Sharpe May 02 '14 at 09:18
7

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>

Lukos
  • 1,826
  • 1
  • 15
  • 29
  • YES we need to look into Microsoft.WindowsAzure.Diagnostics EVEN THOUGH the error we got is complaining about Microsoft.WindowsAzure.ServiceRuntime". Initially I think some thing wrong is quoted as both are different but when I faced this error and found no error the above did caught the issue. for me the Microsoft.WindowsAzure.ServiceRuntime" is 2.3.0.0 and its dll is also 2.3.00 but for Microsoft.WindowsAzure.Diagnostics is pointing to 2.2.0.0 buts its assembly version is 2.3.0.0. – AKS Nov 13 '14 at 12:05
3

This happened to me when i upgraded to 2.3.0.0.

To fix it i went in to references -> right clicked the dll -> clicked Properties -> set copy local to true.

Micah
  • 10,295
  • 13
  • 66
  • 95
  • 1
    We upgraded to used azure sdk 2.3 and found that websites worked locally without the Microsoft.WindowsAzure.ServiceRuntime referenced. When the websites were published to Azure they demanded this dll. Added to projects from the 2.3 sdk and ticked copy local as described for an earlier version. Re-publish and this dll gets copied over. Fixed. – Steven Chalk Jun 05 '14 at 09:08
1

I believe I've hit the exact same issue as you (if I remember correctly). The 1.8 SDK contained a reference to the old StorageClient dll. Try adding a reference in your project to:

Microsoft.WindowsAzure.StorageClient version 1.7.0.0 

Let me know if this helps!

ASGM
  • 11,051
  • 1
  • 32
  • 53
Matt Wilson
  • 231
  • 1
  • 3
  • thanks for your reply I just edited question with one picture please see if I am on right path – SOF User May 31 '13 at 18:36
  • I just enable fusion log so can anyone help me in finding actual issue errors are showing here http://concerthall.simpletix.eu/ – SOF User May 31 '13 at 19:10
-1

I had this issue as well recently. Based on my research this can be caused by a multitude of reasons. The best way to resolve this is to first diagnose it. To get a better diagnosis, enable all CLR exceptions from your Exceptions window. Now your Visual Studio will break on any kind of exception that is thrown. From here you should be able to see the inner details of the exception.

AlvinfromDiaspar
  • 6,611
  • 13
  • 75
  • 140