Solving Could not load type system.servicemodel.activation.httpmodule from assembly System.ServiceModel

In this post, we will learn how to solve “Could not load type system.servicemodel.activation.httpmodule from assembly system.servicemodel” that you may face After Installing a .NET Framework 4.0.


Could not load type system.servicemodel.activation.httpmodule

This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has some tags that are not compatible with the .NET Framework 4.0.

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

Could not load type system.servicemodel.activation.httpmodule
Could not load type ‘system.servicemodel.activation.httpmodule’ from assembly ‘system.servicemodel

Solution

To solve “Could not load type system.servicemodel.activation.httpmodule from assembly ‘system.servicemodel, you have four different options as the following:

  1. Updating Applicationhost.config.
  2. Perform ASP.NET IIS Registration.
  3. Turn on the Named Pipe Activation feature.
  4. Remove ServiceModel 3.0 from IIS

1) Updating Applicationhost.config

Steps

  • Go to Applicationhost.config file that located in %windir%\system32\inetsrv\config
  • Open Applicationhost.config for edit and search for “ServiceModel”
edit Applicationhost.config
system.servicemodel.activation.httpmodule
  • Replace the following Tag
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule,
 System.ServiceModel, Version=3.0.0.0, Culture=neutral,
 PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />
  • With the belowtag
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule,
 System.ServiceModel, Version=3.0.0.0, Culture=neutral,
 PublicKeyToken=b77a5c561934e089" 
preCondition="managedHandler,runtimeVersionv2.0" />
  • Save the file.
  • Go back to browse your site that should be now working properly.

2) Perform ASP.NET IIS Registration.

If the above solution doesn’t work, you will need to perform ASP.NET IIS Registration using CMD as the following:

Steps
  • Go to Start Menu > Run > cmd.
  • Type the following command
cd  %windir%\Microsoft.NET\Framework\v4.0.30319 -->> aspnet_regiis.exe /iru
error-cmdaspnet_reg

3) Turn on the Named Pipe Activation feature

In windows Server 2016 / 2012, you should Turn on the Named Pipe Activation feature as the following:

Steps
  • Open Server Manager > Manage > Add Role and Features.
Add role and feature in Windows Server
  • Follow the wizard, and at Features > click on .Net framework 4.5 features > WCF Services > Check “Named Pipe Activation”
Turn on the Named Pipe Activation feature

For windows 10 and windows 8, you have to use control panel > Programs and Features > Turn on Windows Features on or off, check “Named Pipe Activation”

turn on Named Pipe Activation in windows 10

4) Remove ServiceModel 3.0 from IIS

If the above solution doesn’t work, make sure that the ServiceModel 3.0 in IIS Modules is removed by doing the following:

  • Open IIS > Click on Server Name > Modules.
remove service model 3 from iis
  • Search for ServiceModel 3.0 > Right Click and select Remove.
remove module from iis

Conclusion

After installing .NET Framework 4.0, you may get “Could not load type system.servicemodel.activation.httpmodule from assembly ‘System.ServiceModel”. so In this post, we have provided 3 solutions to fix this issue.

See Also

Leave a Reply