Unable to activate service because it does not support ASP. NET compatibility
Error message:Service cannot be activated because it does not support ASP. NET compatibility. ASP. NET compatibility has been enabled for this application. Disable ASP. NET compatibility mode in Web. config or add the aspnetcompatibilityrequirements attribute to the service type and set requirementsmode to allowed or required ".
By default, Asp. net compatibility support is disabled, but many times you need to enable ASP. net compatibility to use ASP.. net. For more information, see http://msdn.microsoft.com/zh-cn/library/ms752234.aspx.
To enable compatibility, perform two steps: first, add the following mark to the service class:
[Aspnetcompatibilityrequirements (requirementsmode = aspnetcompatibilityrequirementsmode. Required)]
Public class appruntimestatesvc: iappruntimestatesvc
{
// Service code.
}
Add the following content to the <system. servicemodel> section of Web. config:
<Servicehostingenvironment multiplesitebindingsenabled = "true" aspnetcompatibilityenabled = "true"/>
Note that the Framework 3.5 is supported by default, and the 4.0 is not supported by compatibility by default.