"Could not load type 'System.ServiceModel.Activation.HttpModule'" error OR "Handler "ScriptHandlerFactory" has a bad module "ManagedPipelineHandler" in its module list" error OR "Object reference not set to an instance of an object"error when trying to open the asmx in a web page error
Any of the above errors can occur when .NET is not installed/working correctly in IIS. This can happen if IIS or its related server roles are installed after the .NET Framework is installed.
One way to fix it is to re-install and re-register the .NET Framework with IIS, using the command:
aspnet_regiis.exe lives in C:\Windows\Microsoft.NET\Framework64\v4.x.xxxx
Note: aspnet_regiis.exe no longer works in Server 2012R2 or Windows 8.1 or later. Instead, you have to remove the .NET 4.5/3.5 services and re-install them: