Could not load type System.ServiceModel.Activation.HttpModule

If you install DotNet framework 4.0 on IIS server and then enable DotNet 3.0 or 3.5 WCF features, 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=3.0.0.0, 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=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′.

Resolution

To resolve this issue, run the following from command line:

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)

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

  1. This post is really helpful for me. I was trying since last 3 hours and finally fix that error with your solution.

    Thanks

  2. Growl. Sharepoint 2010 pre-reqs ended up triggering this for me. Running aspnet_regiis got me back up.

  3. Thanks. the error seemed to come out of nowhere. I think it was triggered from altering the SMTP settings.. odd

  4. Finally got it worked by running
    C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis -i
    Many thanks!

  5. I had the same problem, but aspnet_regiis didn’t fix it.

    If everything else fails, try this:

    Get the “dotnetfx_cleanup_tool” from http://blogs.msdn.com/b/astebner/archive/2008/08/28/8904493.aspx (I think one of the download links fails, so use the other one)

    Uninstall frameworks 2.0 and above (I did 3.5, 3.0, 2.0. 2.0 made me reboot).

    IMPORTANT: Go to C:\WINDOWS\Microsoft.NET\Framework and delete or rename the folders for the versions of .NET you removed.

    Then I installed .NET Framework 2.0 SP2 (reboot afterwards) and .NET Framework 3.5 SP1 (works without rebooting).

    Now I don’t get the “Could not load type” error! (and actually it worked with just 2.0 SP2 installed, but also after 3.5 SP1 was installed)

  6. Good info!!! People who are facing this issue for SharePoint 2010, just check .net runtime version of “SecurityTokenServiceApplicationPool” and “SharePoint Central Administration v4″. It has to v2.0, I spend almost 2 hours to resolve this issue on my box.

    Enjoy!!!

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>