WCF error: The service cannot be activated because it does not support ASP.NET compatibility

Home | WCF | WCF error: The service cannot be activated because it does not support ASP.NET compatibility

I got the following error when I was trying to host my WCF service in IIS 7.5 using WsHttpBinding

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’.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: 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’.

Solution:

One of the  solution is to turn-off ASPNet compatibility in service configuration file

<serviceHostingEnvironment aspNetCompatibilityEnabled="false"/>. It worked for me.

One thought on “WCF error: The service cannot be activated because it does not support ASP.NET compatibility

Leave a Reply