Error : “Unable to start debugging on the web server…” ASP.NET 4.0

I am getting an error when I want to create a web site on IIS server. I am using Windows 7 and Visual Studio 2010.

Do I have to register or configure 4.0 for the IIS ?

There aren’t many details here, but I was getting that same error while trying to Start Debugging on a web application project in Visual Studio 2010 that I’d just changed from 3.5 to 4.0.

This solved the problem for me from the command line:

cd %windir%\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i

Just make sure to go into IIS Manager afterwards and double-check your application pools and such, since it’s likely that this will reset some of your configuration.