Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

How to Resolve the 'Could not load type System.ServiceModel.Activation.HttpModule' Issue?

0.00/5 (No votes)
20 Aug 2015 1  
Guides to resolve the 'Could not load type System.ServiceModel.Activation.HttpModule' issue

Introduction

Sometimes, we might get the following error when we try to access a Service.svc after creating the Web or WCF project with Visual Studio.

Could Not Load Type 'System.ServiceModel.Activation.HttpModule' 
From Assembly 'System.ServiceModel, Version=3.0.0.0, 
Culture=neutral, Publickeytoken=b77a5c561934e089'.

The reason, when there are multiple versions of .NET framework on the computer where IIS is running, and IIS was configured after installing .NET Framework 4.0 or before registering the Service Model in Windows Communication Foundation.

Resolution

In order to fix this issue, we need to register the correct version of ASP.NET with ASP.NET IIS Registration Tool(aspnet_regiis.exe).

Please do the steps as below:

  1. Open the command prompt with elevated rights (Run as Administrator).
  2. Change the directory to %WINDIR%\Microsoft.NET\Framework\v4.0.30319 or %WINDIR%\Microsoft.NET\Framework64\v4.0.30319
  3. Type the following command, then press enter.
    aspnet_regiis.exe -iru
    Console output:
    	Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929
    	Administration utility to install and uninstall ASP.NET on the local machine.
    	Copyright (C) Microsoft Corporation. All rights reserved.
    	Start installing ASP.NET (4.0.30319.17929).
    	...
    	Finished installing ASP.NET (4.0.30319.17929).

    Basically, the above command registers the current version of ASP.NET on IIS and it will not force the IIS to use the current version if there is any other ASP.NET version application already running.

  4. After getting the finished message from the above command, use the following command to restart the IIS.

    iisreset

    Command Prompt Result
  5. Go back to Visual Studio and try to run the project, now it will work as we expected.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here