Could not load type 'System.ServiceModel.Activation.HttpHandler' Version conflict with WCF REST

Rick Strahl picture Rick Strahl · Jan 6, 2011 · Viewed 18.2k times · Source

I've run into a problem with WCF REST Service. I get:

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

when running inside of the IIS in an ASP.NET 4.0 AppPool.

The problem seems to occur only if:

  • Running inside of IIS
  • When ASP.NET Comaptibility is enabled

Running in Cassini - no problem it works properly. Running with ASP.NET compatibility off - no problem it works.

It appears that it's some sort of handler version conflict trying to instantiate the wrong version of the handler that in turn tries to load an older version of System.ServiceModel, but I haven't been able to trace this down.

Anybody seen anything like this before and have any ideas how to track this down further?

I've looked in ApplicationHost.config and the master web.config files for System.ServiceModel and HttpHandler references but no luck. There.

+++ Rick ---

Answer

Sriwantha Attanayake picture Sriwantha Attanayake · Nov 8, 2011

fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt:

aspnet_regiis.exe -iru

This will register latest .net version. Also make sure your app pool is running latest version of .net