This error occurs when you have MVC 2+ running hosted on IIS 7+, this is because ASP.NET 4 was not registered in IIS. In my case I was creating a MVC 3 project and hosting it on IIS 7.5.
To fix it, make sure you have MVC 2 or above and .Net Framework 4.0 installed, then run a command prompt as administrator and type the following line:
32bit (x86)
1
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir
64bit (x64)
1
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe –ir