Featured Post

Big House Rocked and we Won!

Michigan rolled over Bowling Green in a 42 to 7 victory today as Navarre made his debute with the Wolverines. Over 110,000 screaming Michigan fans were in attendance. We were seated in the South end-zone almost on level with the playing field and happened to be mixed in with a couple of BGFU fans. A...

Read More

WCF Service Cannot Be Activated Because of ASP.NET Compatibility

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

3

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.