WCF model is designed to behave smoothly across various hosting environments and transports but very often an application does not need variety of hosting environments. ASP.NET compatibility mode in WCF is suitable for cases where we need all of features of the ASP.NET Web application platform and do not require host outside of IIS or to deal with protocols other than HTTP.In ASP.NET Compatibility Mode WCF services involves fully in the ASP.NET pipeline. In this mode it behaves similar to the way requests for ASPX pages and ASMX Web services are dealt.WCF’s ASP.NET compatibility mode can be enabled at the application level via web.config by setting "aspNetCompatibilityEnabled" key The default value of aspNetCompatibilityEnabled key above is "false" (in 4.5 framework it is "true" by default) if not specified. Setting this value to “true” signifies that all the WCF services running in the application will run in ASP.NET Compatibility Mode. The above information was for setting ASP.NET compatibility at application level now come to individual WCF service.Individual service can have the ability to control whether to run in ASP.NET Compatibility Mode or not. WCF services implement this via using AspNetCompatibilityRequirementsAttribute.With "aspNetCompatibilityEnabled" property having 2 values true|false and "AspNetCompatibilityRequirementsMode" enum having 3 values Required|Allowed|NotAllowed there can be six cases which can be there in our application.
aspNetCompatibilityEnabled = "true"
aspNetCompatibilityEnabled = "false"