AspNetCompatibilityRequirements blocks connection to self hosted WCF service RRS feed

  • Question

  • Conditions: WinXP SP3, VS2010, .Net 4.0, Self-hosted WCT service, ASP.NET IIS 5.1 hosted web page. Web page works in VS Development server, remotely via IE and on local machine via IE. Need to do cookies, and found that I need to have  an entry in the app.config file:

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"

    aspNetCompatibilityEnabled="true"/> and to decorate the service class with [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

    The problem is that the AspNetCompatabilityRequirements prevents the web page from connecting to the server. Error message inside the web page was:

    There was no endpoint listening at http://localhost:8732/EICServerWindowsService/ that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
    and the InnerException shows:
    InnerException: Check the Response property of the exception to determine why the request failed.

    The response property has a field called SubStatusCode which has the string: "base {System.NotSupportedException} = {"This operation requires IIS integrated pipeline mode."}"

    I have no idea about what this means nor how to go about fixing it. Searching VS2010 help indicates the problem cannot be solved in IIS 5.1, which is what I am using.

    New information: Ran the WCF service on a Windows Server 2008 R2 and IIS 7, got an error message that either the service needs to be hosted in IIS or change the compatability requirements mode to something other that required. I set it to Allowed and the HttpContext.Current is null - still.

    That said, how do I go about getting access to the HttpContext.Current object (which is where I was trying to go in the first place)? The intent is to send and receive cookies between the service and the web application. I'm beginning to think that it is not possible...!

    Any ideas will be very welcome.

    • Edited by roadkill4299 Thursday, May 24, 2012 3:59 PM more information
    Thursday, May 24, 2012 3:03 PM


  • Hi, ASP.NET compatibility mode can only be used when your service is hosted in IIS and not with a self host hosted service. It is IIS that provides the HttpContext in this senario. If you are trying to use cookies for some sort of session state, consider using Sessions with WCF. Sessions in WCF provide a great state management facility between client and service.

    Read this article for information and an example using WCF Sessions: 

    Friday, May 25, 2012 1:18 AM