Loading ...

WCF Services in ASP.NET Compatibility Mode | CodeAsp.Net

WCF Services in ASP.NET Compatibility Mode

 /5
0 (0votes)

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.

Compatibility Mode setting (web.config) ["AspNetCompatibilityRequirementsMode"] setting on service Result
aspNetCompatibilityEnabled =
"true"
Required Service activated

aspNetCompatibilityEnabled =
"true"

Allowed Service activated

aspNetCompatibilityEnabled =
"true"

NotAllowed Service not activated

aspNetCompatibilityEnabled =
"false"

Required Service not activated

aspNetCompatibilityEnabled =
"false"

Allowed Service activated

aspNetCompatibilityEnabled =
"false"

NotAllowed Service activated

 

Comments (no comments yet)

Top Posts