Could not load file or assembly 'System.Web.Http 4.0.0 after update from 2012 to 2013

前端 未结 28 1102
悲哀的现实
悲哀的现实 2020-11-28 01:09

I did the upgrade according to. http://www.asp.net/mvc/tutorials/mvc-5/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2

I get the er

相关标签:
28条回答
  • 2020-11-28 01:47

    Change the Specfic version flag from true to false for the dll in the reference

    0 讨论(0)
  • 2020-11-28 01:48

    I had this from a WCF service. For me (as the issue was displaying in local dev), I simply had to delete the contents of the bin folder under the solution. The the rebuild work fine once again.

    0 讨论(0)
  • 2020-11-28 01:52

    The proper solution to resolve this issue is by following the steps

    . Update Visual studio if you have older version to 15.5.4 (Optional)

    1. Remove all binding redirects from web.config

    2. Add this to the csproj file:

     <PropertyGroup>
      <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
      <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
    </PropertyGroup>
    
    1. Build.

    2. In the bin folder, there should be a (WebAppName).dll.config file.

    3. It should have redirects in it. Copy these to the web.config

    4. Remove the above snipped from the csproj file again

    5. It should work

    Detailed Blog

    0 讨论(0)
  • 2020-11-28 01:52

    For me it was only crashing with this error on a production environment, not on local machine; what solved it was to delete the content of /bin folder and then to regenerate it again.

    0 讨论(0)
  • 2020-11-28 01:52

    In my case, I was actually missing my web.config altogether, which had the appropriate binding redirects. Restoring the web.config resolved the error.

    0 讨论(0)
  • 2020-11-28 01:52

    Me did not nothing, just copied development Bin folder DLLs to online deployed Bin folder and it worked fine for me.

    0 讨论(0)
提交回复
热议问题