I just re-installed Windows 7 on my machine. Once I opened and tried to run an old web project configured for VS 2010 and .NET 4.0, my IIS server threw an exception. I went into Windows features and enabled all IIS features related to ASP.NET and WCF. Even after all this I still got the following error:
HTTP Error 500.21 – Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
I checked web.config, and it looked correct, plus it has not changed in a while. After some research I found out that even though ASP.NET 4.0 was showing up in properties of my virtual directory, ASP.NET still did not function properly. The solution was to run aspnet_regiis –i after all. One thing to remember is to run this utility from Microsoft.NET v4 folder, not 2.0 folder. Once I ran the utility, I was back in business.
I hope this helps someone with the same issue.