Recently a set of developers who are working in one of my projects started getting an error while trying to debug the web application under development using ASP.Net. The targeted framework was .Net 4.0 and they were using Visual Studio 2010 in 64bit machines. The problem was whenever they tried to run/debug the application they gets an error saying unable to start debugging on the web server even though there are no compile errors as shown below.
It gave an error HTTP Error 500.21 - Internal Server Error Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list when ran direct from IIS. The error page is shown below.
Later I found the reason for this is ASP.Net 4 was not properly installed on the machine. To fix this get an administrative privileged command prompt.
Then type in the following,
You can find the aspnet_regiis.exe at the folder,
This will register ASP.Net 4.0 in your machine, the -ir option will keep the existing applications unchanged. If you want them to be changed to use the new version use -i instead -ir.
When the installer ends type iisreset to restart the IIS service.
Now your applications will work fine without any complains.