HTTP Error 500.21 – Internal Server Error Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list error. on Amazon EC2

I was attempting to update our installation of ScorpionSoft’s AuthAnvil product on our Amazon EC2 installation and after updating to the latest version of their software (5.0 at this time), I started receiving a HTTP Error 500.21 – Internal Server Error Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list error.

It turns out after some research this is a common bug in Amazon EC2 in ASP.NET 4.0. It may be that ASP.NET is not fully installed, or that something is intentionally disabled, however running the following command fixed the issue for me right away.

%windir%Microsoft.NETFramework64v4.0.30319aspnet_regiis.exe –i

After a few moments the installer finished, and my application was running again correctly.