Click here to Skip to main content
15,891,136 members
Articles / Web Development / IIS

Solve IIS 8 Error: Could not load type ‘System.ServiceModel.Activation.HttpModule’

Rate me:
Please Sign up or sign in to vote.
4.89/5 (24 votes)
30 Jun 2013CPOL2 min read 156.3K   8   20
How to solve "Could not load type 'System.ServiceModel.Activation.HttpModule’ IIS 8 error

Introduction

I encountered an error when I was deploying my WebSocket server application which targeted .NET 4.5 to Windows Server 2012 plus IIS 8. It was an exception shown in browser whenever I tried to open a web page. The exception said:

"Could not load type ‘System.ServiceModel.Activation.HttpModule’ from assembly
 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'"

When I was working on IIS 7.5, I heard about this problem and knew the cause: the default configuration in applicationHost.config (in C:\Windows\System32\inetsrv\config) declared two conflicted modules and two conflicted handlers:

XML
<modules>
  <add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, 
  System.ServiceModel, Version=3.0.0.0, Culture=neutral, 
  PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
  <add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule, 
  System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, 
  PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" />
</modules>
<handlers>
  <add name="svc-Integrated" path="*.svc" verb="*" 
  type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, 
  Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode" />
  <add name="svc-Integrated-4.0" path="*.svc" verb="*" 
  type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, 
  System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, 
  PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>

As we know, applicationHost.config contains the root settings for all web sites and web applications on the server. Therefore, any web application would have all the four conflicted modules and handlers loaded by default. “ServiceModel” and “svc-Integrated” were for .NET Activation 3.x while “ServiceModel-4.0” and “svc-Integrated-4.0” were for .NET Activation 4.x. Unfortunately, the 3.x items were declared before the 4.x items. That was why the exception occurred for a .NET 4.x web application!

Then how did such a situation happen? On Windows Server 2008, it could happen when you install .NET 3.x framework or IIS 7.5 with Activation features after .NET framework 4.x is installed. However, on Windows Server 2012, it always happens when you install .NET framework 3.x with Activation features.

Microsoft officially announced the solution (http://support.microsoft.com/kb/2015129) for Windows Server 2008 plus IIS 7.5: manually running “aspnet_regiis.exe /iru” for .NET framework 4.x (in C:\Windows\Microsoft.NET\Framework\v4.0.30319 or C:\Windows\Microsoft.NET\Framework64\v4.0.30319). However, aspnet_regiis.exe is not allowed to run for IIS 8. I tried manually changing applicationHost.config. I also tried removing and adding features in a good order. But all these solutions did not work.

The final solution was to delete the 3.x module and handler from IIS manager. You could delete them at the application or site level if you want to keep them in applicationHost.config. But I wanted to delete them from applicationHost.config. So I did the following steps:

  1. In IIS manager, click the machine name node.
  2. In “Features View”, double-click “Modules”.
  3. Find “ServiceModel” and remove it.

  4. Go back to the machine name node’s “Features View”, double-click “Handler Mappings”.
  5. Find “svc-Integrated” and remove it.

Now everything works well.

This article was originally posted at http://blog.csdn.net/pkudzy/article/details/9208165

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
China China
Over 10-years experience in using Microsoft technologies.
At present, working as the architect of a clustered real-time data delivery and visualization system, responsible for the design of component architecture, product packaging and deployment, also targeting private cloud solutions for future.

Comments and Discussions

 
QuestionI still having problems Pin
Member 100455187-Dec-17 7:11
Member 100455187-Dec-17 7:11 
Hello

I did all that you suggested but I still having problems.I deleted
Name: ServiceModel
Type: System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 from Modules
and I deleted
Request path: *.svc
Type: System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Name: svc-Itegrated from JHandeler Mappings

I'm getting the next error
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

I'm trying to publish in my local IIS a web service Framework 4.5 Application Pool .Net v4.5. I made it in VS2017, I have Windows 10 and IIS (version 10.0.14393.0)

My IIS is able to publish web services Framework 4.0 and 3.5 is the same application but with different framework, the problem came with FK 4.5. So if you can help me with that I will appreciate you.
Do you have an idea what is happening?

Thanks
Questionthanks Pin
Member 1346233712-Oct-17 16:03
Member 1346233712-Oct-17 16:03 
Questionthanks Pin
jamil shah7-Nov-16 20:42
professionaljamil shah7-Nov-16 20:42 
PraiseThanks! Pin
User 5123917-Sep-16 15:19
User 5123917-Sep-16 15:19 
QuestionThanks!!! Pin
Panikovsky18-Aug-16 1:38
Panikovsky18-Aug-16 1:38 
GeneralMy vote of 5 Pin
Greg Mulvihill6-Jun-16 10:50
Greg Mulvihill6-Jun-16 10:50 
PraiseThanks!! Pin
Juanvv17-May-16 9:52
Juanvv17-May-16 9:52 
QuestionIt Worked. Great. Pin
contactckszee31-Dec-15 19:11
contactckszee31-Dec-15 19:11 
PraiseIt works! Pin
JasonChing28-Dec-15 2:45
JasonChing28-Dec-15 2:45 
QuestionThanks Pin
bobrob12-Oct-15 8:04
bobrob12-Oct-15 8:04 
QuestionThanks Pin
SunilGupta04859-Sep-15 3:55
professionalSunilGupta04859-Sep-15 3:55 
Questiontnx! int Work but what if ... Pin
AminMhmdi24-Mar-15 5:10
professionalAminMhmdi24-Mar-15 5:10 
QuestionIIS on Win 8.1 Enterprise - Works! Pin
Member 843722124-Mar-15 4:22
Member 843722124-Mar-15 4:22 
QuestionIt worked for me as well thank you!! Pin
Ioannis Papaioannou5-Mar-15 14:31
Ioannis Papaioannou5-Mar-15 14:31 
AnswerIt worked for me Pin
ericardezp14-Jan-15 6:32
ericardezp14-Jan-15 6:32 
Generalit works for me Pin
Оксана Липанова3-Dec-14 3:02
Оксана Липанова3-Dec-14 3:02 
Generalit worked for me :) Pin
shubhampareta31-Oct-14 22:35
shubhampareta31-Oct-14 22:35 
QuestionI did it. Pin
19871986622-Aug-14 2:30
19871986622-Aug-14 2:30 
QuestionYes this worked. Pin
Muhammad Zaheer Nazir23-Jun-14 2:41
Muhammad Zaheer Nazir23-Jun-14 2:41 
GeneralThanks! Pin
capitan_cavernicola18-Feb-14 23:42
capitan_cavernicola18-Feb-14 23:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.