Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to load Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, ............. Local works fine

After publishing the cloud based application (web role) from visual studio, application gives following error on accessing the landing page.

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Locally the same application works fine. I have kept the reference of Microsoft.WindowsAzure.ServiceRuntime Copy Local attribute to True in its property while publishing the site.

I am using AzureSDK 2.0 and have reference of all storage services of version 2.0 in the reference folder.

I also have following in my web.config file.

Still am getting the above error. Please suggest how to solve the issue.

like image 623
iomca4u Avatar asked Oct 22 '22 06:10

iomca4u


1 Answers

Expand the references section in Visual Studio and mark all the Azure DLLs as Copy Local = "True" - the Azure SDK DLLs need to be included in the bin directory they are not GACed.

If that fails, add an assembly binding redirect to the web.config...

  <dependentAssembly>
    <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime"
         publicKeyToken="31bf3856ad364e35" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
  </dependentAssembly>
like image 75
viperguynaz Avatar answered Oct 27 '22 21:10

viperguynaz