It is written here on Microsoft pages .
Hosting WCF Services in ASP.NET Compatibility Mode
Although the WCF model is designed to behave sequentially in host environments and transport, scenarios often arise when an application does not require this degree of flexibility. WCF compatibility mode for ASP.NET is suitable for scenarios that do not require the ability to be placed outside of IIS or for communication using protocols other than HTTP, but which use all the features of the ASP.NET web application platform.
Unlike the default configuration by default, where the WCF hosting infrastructure intercepts WCF messages and routes them from the HTTP pipeline, WCF services running in ASP.NET compatibility mode fully participate in the ASP.NET HTTP request life cycle. In compatibility mode, WCF services use the HTTP pipeline through the IHttpHandler implementation, similar to how requests for ASPX pages and ASMX web services are processed. As a result, WCF behaves the same way with ASMX with respect to the following ASP.NET features:
- HttpContext: WCF services running in ASP.NET compatibility mode can access Token and its associated state.
- File Based Authorization: WCF services running in ASP.NET compatibility mode can be protected by attaching file system access control lists (ACLs) to the .svc services file.
Configurable URL authorization: ASP.NET URL authorization rules are enforced for WCF requests when the WCF service is running in ASP.NET Compatibility Mode.
HttpModuleCollection extension: since WCF services running in ASP.NET compatibility mode are fully involved in ASP.NET HTTP, any request life cycle, any HTTP module configured in the HTTP pipeline, capable of handling WCF requests both before and after the service
- ASP.NET impersonation: WCF services are started using the current ASP.NET impersonated thread identifier, which may differ from the IIS process identity if ASP.NET impersonation was enabled for the expression. If the impersonation of ASP.NET and the impersonation of WCF are both for a specific service operation, the service implementation is ultimately performed using an identifier derived from WCF.
ASP.NET WCFs compatibility mode is enabled at the application level through the following configuration (located in the Web.config application file):
<system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" /> </system.serviceModel>
source share