inside

HttpContext in WCF

To use httpContext, I changed app.config and added <serviceHostingEnvironment aspNetCompatibilityEnabled="true"> inside <system.serviceModel> .

I also added using System.Web to my implementation class.

The problem is that httpcontext is not available in my implementation class after completing the necessary steps.

What am I missing?

+4
source share
3 answers

See here: WCF Services and ASP.NET

In the AppDomain application, the functions used when performing HTTP execution for ASP.NET content, but not for WCF. Many of the HTTP-specific features of the ASP.NET Application Platform cannot be applied to WCF services hosted inside the AppDomain containing ASP.NET content. Examples of these features include the following:

HttpContext: the current is always zero when accessing from WCF service provision. Use RequestContext instead.

+9
source

Access to the HttpContext in WCF is possible if you install AspNetCompatibility in web.config and in the service implementation.

See here .

+2
source

All Articles