Featured Post

Ruger P345 .45 ACP Pistol

After paying my Jeep off last week I had some extra cash to get something I have been wanting to get for a long time and that is a self defense pistol. After looking, thinking, researching, reading, talking to friends and getting everyone’s input under the sun, I finally decided on the Ruger .45....

Read More


WCF Service Cannot Be Activated Because of ASP.NET Compatibility

Posted by Keith Elder | Posted in WCF | Posted on 08-03-2010

I just created a brand new solution in Visual Studio 2010 Release Candidate playing around with some new ideas on WCF Data Services. I launched the solution to test my service and I was greeted with this lovely error:

The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as ‘Allowed’ or ‘Required’.

This is a pretty easy fix but I thought I’d blog it anyway.  There are two options as the error points out.  Add an attribute or change the config file.  Here’s what you need to add if you want to go the attribute route:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]

If you want to go the web.config route instead then change the serviceHostingEnvironment element as follows.

<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="false" />

Hope this helps.

  • http://twitter.com/sumitbbd Sumit Bisht

    What if I don’t want to do aspNetCompatibilityEnabled=”false” in the config file ?

  • Anonymous

    Thanks! Got me going.

  • Anonymous

    Thanks. Your opinion solved my problem!