5

After moving my Azure web app to SDK 2.1 I have started getting the

type initializer for 'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment' threw an exception.

error message. The same is working fine in the local environment but gives above error on Azure.

My web.config already has following entries:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.WindowsAzure.StorageClient"
          publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-1.7.0.0" newVersion="1.7.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime"
          publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-1.8.0.0" newVersion="1.8.0.0" />
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics"
          publicKeyToken="31bf3856ad364e35" culture="neutral" />
      <bindingRedirect oldVersion="0.0.0.0-2.1.0.0" newVersion="2.1.0.0" />
    </dependentAssembly>
  </assemblyBinding>
</runtime>

and

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

still it's not working in live Azure. Can someone please help me out?

sharptooth
  • 167,383
  • 100
  • 513
  • 979
iomca4u
  • 235
  • 4
  • 15

1 Answers1

0

It is possible that you may be running different Windows Azure DLLs than the ones installed (by default) on live Azure instance roles. Right click the Microsoft.WindowsAzure.[any] references in your project and check the version number in the Properties window and try to match them with the version numbers in your config files.

ahmed.eltawil
  • 561
  • 4
  • 16
  • Face similar issue and I checked all Microsoft.WindowsAzure.[*] refrenced and all are ok wrt version numbers of those and in config. – AKS Nov 13 '14 at 14:45