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
I solved this problem by reverting the changes that nuget had made to my web.config
after running nuget
. Revert the changes to a previous working version.
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.2.0" newVersion="5.2.2.0" />
</dependentAssembly>
This might help someone.
I decided to go with MVC4 app.
run project, worked
Then Installed few packages like,
Microsoft ASP.NET WEB API 2.2 (4 packages)
Microsoft ASP.NET WEB API 2.2 Help Page
Microsoft ASP.NET WEB API 2.2 OWIN
run project, same error as mentioned in question
Solution:
In web.config
<dependentAssembly>
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.2.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.2.3.0" />
</dependentAssembly>
Problem Solved
but then, some hotfix error found,
To resolve it,
go to VIEW folder of your MVC4 project,
find second
web.config file and changed version from 2.0.0.0 to 3.0.0.0 as shown below.
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
Installing NuGet package ASP.NET.MVC solved the issue for me.
To install package.
- Right click on project
- Select "Manage NuGet Packages"
- Select Online->Nuget.org from left menu
- select "Microsoft ASP.NET MVC"
- Click Install
If you have already installed package earlier, please update the package by selecting Updates from left menu and then selecting "Microsoft ASP.NET" and click Update.
I found the solution ! Delete folder named package in project directory and then rebuild to run it.