Could not load type System.ServiceModel.Activation.HttpModule

If you install DotNet framework 4.0 on Windows Server 2008 or R2 after enabling IIS,  you might see following error when browse your application site made of ASP.NET 4.0 (or run on ASP.NET 4.0 application pool).

Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.TypeLoadException: Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly ‘System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

Cause & Solution

If IIS is enabled after DotNet 4 installation then ASP.NET is not registered with IIS. You will see the error if your site is targeting ASP.NET 4. To resolve this issue, run the following from elevated command line to register ASP.NET 4:

aspnet_regiis.exe /iru

The aspnet_regiis.exe file can be found in either

  • %windir%\Microsoft.NET\Framework\v4.0.30319
  • %windir%\Microsoft.NET\Framework64\v4.0.30319 (on a 64-bit machine)

More info for ASP.NET IIS Registration Tool (Aspnet_regiis.exe) can be found at

66 thoughts on “Could not load type System.ServiceModel.Activation.HttpModule”

  1. On a pretty much virgin Win7 box I installed nodejs and iisnode (and the URL rewrite extension) following to the letter the instructions listed here ( When I tried to run up the node server (http://localhost/node) I got this exact same error. Since Emma didn’t mention anything about node or any of these modules, I wasn’t hopeful this fix would work…

    So Emma, you’ll be pleased to know, it worked.


  2. After trying the above instructions till i got error “The server committed a protocol violation. Section=ResponseStatusLine”
    anybody know the solution please help me..
    when i try to run the service in wcftestclient it returns error “Error: Cannot obtain Metadata from http://localhost/Aivea.Acs.ServicesHost/Aivea.Acs.Services.ShopService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at Exchange Error URI: http://localhost/Aivea.Acs.ServicesHost/Aivea.Acs.Services.ShopService.svc Metadata contains a reference that cannot be resolved: ‘http://localhost/Aivea.Acs.ServicesHost/Aivea.Acs.Services.ShopService.svc’. The server committed a protocol violation. Section=ResponseStatusLineHTTP GET Error URI: http://localhost/Aivea.Acs.ServicesHost/Aivea.Acs.Services.ShopService.svc There was an error downloading ‘http://localhost/Aivea.Acs.ServicesHost/Aivea.Acs.Services.ShopService.svc’. The request failed with HTTP status 404: Not Found.”

  3. Excellent fix, thanks for the post! Server started and LNLB started reporting ‘The Server’ was alive again.


  4. May the world praise your name until the sun itself envelopes the earth with a final fiery embrace. Thank you!!! You saved my Win7 install.

Leave a Reply

Your email address will not be published.