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

前端 未结 28 1259
悲哀的现实
悲哀的现实 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:40

    I had a similar issue. Everything was working before. It's was originally made using Web Forms and later on added Web API for some things.

    • Tried uninstalling, installing and reinstalling Microsoft.AspNet.WebApi package.
    • Tried removing packages folder from solution and letting NuGet restore in VS.
    • Tried removing individual assembly references (under References) and reinstalling packages.
    • Tried adding binding redirects to 5.2.3.0 version in web.config mentioned in several answers. Nothing worked for me.

    What worked was, in Visual Studio, change publish profile settings from Release to Debug. Strange, but that's what worked. So sharing here.

提交回复
热议问题