Accessing ASP.NET Session, Request, Response (HttpContext / HttpApplication) in WCF


WCF services are designed to be transport independent. Even when they are hosted inside ASP.NET applications, the decoupling of the relationship to the HTTP-flavored features is required so that users are not confused. Also most of those ASP.NET features have counterparts in WCF. Nevertheless, WCF provides a mechanism to support smooth migration from ASMX to WCF by introducing two different hosting modes for WCF services:

  • Mixed Transports Mode
  • ASP.NET compatibility mode

This is controlled by the application-level configuration flag “aspNetCompatibilityEnabled”:


<serviceHostingEnvironment aspNetCompatibilityEnabled=”true”/>


This flag is false by default.

Details from Wenlong Dong’s Blog : ASP.NET Compatibility Mode


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s