Search code examples
asp.netwcfintegrated-pipeline-mode

WCF request doesn't flow via asp.net pipeline


I have a WCF service hosted in an asp.net application.

Here's the service (shortened):

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
[ServiceContract(Name = Name, Namespace = Namespace)]
[ServiceBehavior(Name = Name, Namespace = Namespace)]
public class WcfMaintenanceFacade {...}

Here's hosting:

RouteTable.Routes.Add(new ServiceRoute("entity/maintenance/5.20", new ServiceHostFactory(), typeof(WcfMaintenanceFacade)));

And here's relevant config section:

<system.serviceModel>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
</system.serviceModel>

My service instantiates, the requests are coming in, and event HttpContext.Current is not empty.

There are two (major, for me) issues that I can't solve:

  1. HttpContext.Current.Session is empty
  2. Global.asax's Application_BeginRequest is never called

And yes, from the call stack it seems like the request is going through WCF activation pipeline, not ASP.net pipeline. So what am I doing wrong?


Solution

  • And the answer is simple (and, well, obvious):

    <system.webServer>
        <modules runAllManagedModulesForAllRequests="true">
    

    Yes. RAMMFAR.