Monday, March 19, 2012

IIS 7.5: Could not load type 'System.ServiceModel.Activation.HttpModule'

On an IIS 7.5 I wanted to deploy a .NET 3.0 WCF application. As no handler was registered for *.svc extension on the CLR 2.0, I ran the servicemodelreg.exe tool available in at C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.

However this broke all my existing .NET 4.0 WCF services. The .NET 4.0 svc mapping was replaced by the .NET 2.0 version. As a consequence, every service call resulted in the following error message:

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

This error occured because I installed the 3.0 version of the WCF Http Activation module is installed after installing IIS and .NET Framework 4.

How did I fix this? 

Running the servicemodelreg.exe for .NET 4.0(available at C:\Windows\Microsoft.NET\Framework\v4.0.30319) had no effect.

In the end I found that I had to use the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) to register the correct version of ASP.NET.

Don’t forget to add the –iru parameters when running aspnet_regiis.exe.

No comments: