Could not load file or assembly ServiceRuntime 2.4.0.0

怎甘沉沦 提交于 2019-12-22 03:38:22

问题


After upgrading our project to use the Azure SDK 2.5, I get the following runtime exception when deployed to Azure (web role):

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

One of the referenced packages from NuGet is still referencing ServiceRuntime 2.4.0.0. From what I understand, all I need to do to fix this is create a bindingRedirect in our web.config:

<dependentAssembly>
    <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-2.5.0.0" newVersion="2.5.0.0"/>
</dependentAssembly>

Unfortunately this doesn't work. The exception persists. Can anyone provide guidance?


回答1:


After upgrading to SDK 2.5 myself i had the same problem you have now. I went trough all of the projects in the solution, and checked all of the references to Microsoft.WindowsAzure.ServiceRuntime. Remove them, and add them again using the Add Reference option. Select the assembly again, however make sure it is the 2.5.0.0 version. Rebuild and redeploy. Things should work again now.




回答2:


For me, setting the Copy Local property to True for the referenced assembly fixed this.

  1. In Solution Explorer find your project's reference to the library.
  2. Right click and choose Properties
  3. In the Properties window set Copy Local to True


来源:https://stackoverflow.com/questions/29115731/could-not-load-file-or-assembly-serviceruntime-2-4-0-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!