Search code examples
c#.netnamed-pipesglobal-asaxlifecycle

Global Application_Start not firing calling my service using Named Pipes


I have a service running on Named Pipes. The service should do some stuff on startup, so I defined this in the Global.asax. Now I am experiencing that this is not being when the service receives it first call. Is using Named Pipes different in this way?

protected void Application_Start(object sender, EventArgs e)
{
    Log.Information("Application_Start().");
    DoSomeStuff();
}

Solution

  • Non-HTTP endpoints do not pass the IIS processing pipeline and will get routed directly to the WCF runtime. This means that you can't use an HttpModule to pre- or post-process requests. In addition, the Application_Start and Application_End of the HttpApplication class (global.asax) don't fire. So if you want to run startup or cleanup code for such services, you have to use the events of the ServiceHost class.

    Source