Click here to Skip to main content
15,887,477 members
Articles / Web Development / ASP.NET
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
20 Aug 2015CPOL 6.4K   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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect FE
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --