“Could not load type ‘System.ServiceModel.Activation.HttpModule'”

I was updating an existing WebService and when I tried to test it if it runs on a browser, IIS is giving me this error:

Exception Details: System.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

Cause:

This issue occurs because the Applicationhost.config file for Windows Process Activation Service (WAS) has the following section defined, and this section is incompatible with the .NET Framework 4.0:

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

This section should be defined as follows:

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

Resolution:

To resolve this issue, run the following command line:

aspnet_regiis.exe /iru

The Aspnet_regiis.exe file can be found in one of the following locations:

%windir%\Microsoft.NET\Framework\v4.0.30319
%windir%\Microsoft.NET\Framework64\v4.0.30319 (on a 64-bit computer)

Hope that helped you guys too.

Source: http://support.microsoft.com/kb/2015129

Leave a comment