Featured Post

How To Add Holidays to Outlook 2007 Calendar

After installing Outlook I have found the default installation does not automatically add holidays to the calendar.  When scheduling appointments and tasks it is important to know the holidays.  For example, a husband can find himself in a lot of trouble if he schedules a dinner with a client on Valentine’s...

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!