Could not load type ‘System.ServiceModel.Activation.HttpModule’ after installing the .NET Framework 4.0

After Installing a .NET Framework 4.0. If you decided to

  • Install an earlier version of the .NET Framework,
  • Or enable .NET 3.0 WCF HTTP Activation.

You might get the following error message

Could not load type ‘System.ServiceModel.Activation.HttpModule’

When you tried to brows a web applications that has been hosted on Internet Information Services (IIS)

error-ServiceModel

Cause :

This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has the following section defined,

<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule,
 System.ServiceModel, Version=3.0.0.0, Culture=neutral,
 PublicKeyToken=b77a5c561934e089" preCondition="managedHandler" />

Where this section is incompatible with the .NET Framework 4.0.

Solution:

  • Go to Applicationhost.config file that located in %windir%\system32\inetsrv\config
  • Open Applicationhost.config for edit and search for  ServiceModel

error-application

  • 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" />
  • By the following tag
<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.

Second Solution

  • 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

This also should be solve the issue.

Enjoy 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s