I have a web service project and I want to run a thread in the event of server starts.
- How do I add an entry point to my project?
- how do I register a function to server stop event?
Edit 1
I have added the Global.asax.ch, but it wont stop in the breake point or print to the console
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
Debug.WriteLine("start");//break point
}
...
}
Thanks
If you expose your WCF service through http binding (ws/basic) or if you use whatever kind of service that is expose through http, you can add a global.asax file to you project and code the Application_Start and Application_Stop events.
If it is a WCF service, you can also create you own host factory and code startup event there but then you wont have any equivalent of a stop event.