I am getting this error when I try to deploy my Web API project to both Cloud WebSites and Cloud Hosted Services on Azure:
\"{\"ExceptionType\":\"System.Type
You are right about starting in .NET 4.5 and rolling back causing the issue, here is the official documentation about this issue and a link.
Changing an ASP.NET MVC 4 project to target 4.0 from 4.5 does not update the EntityFramework assembly reference: If you change an ASP.NET MVC 4 project to target 4.0 after targetting 4.5 the reference to the EntityFramwork assembly will still point to the 4.5 version. To fix this issue reinstall the EntityFramework NuGet package.
Reinstalling EntityFramework after switching project to .NET 4.0 did the trick.
Reference: http://www.asp.net/whitepapers/mvc4-release-notes#_Toc303253815
This happened to me when I compiled an MVC RC project in .NET 4.0 and tried to host it in IIS on a server that did not have Visual Studio 2012 RC installed.
(Note: Installing Visual Studio 2012 RC on the server also fixed the issue, but for backward-compatibility the above fix is much better.)
So it seemed that the problem was caused by me rolling back to .NET 4 from 4.5 and Entity not rolling back. It seems that Entity 5 only runs on .NET 4.5 and when the deployment was expecting 4.3.1 it had a 5.0.0 DLL and it messed everything up.