Search code examples
asp.netiisweb-applications

ASP.Net how to auto start the Application without user first request to the server?


I have some scheduled jobs that need to be run in the Application_Start but as far as I know, this method only get triggered after the first request. Is there anyway I can just auto startup the application after I stop and start the connection in IIS or stop/start/restart the site?


Solution

  • If you are on IIS 7.5, you can setup the application auto start, as you can see on this post on the ScottGu blog.

    Basically, you have to add the startMode=”AlwaysRunning” attribute on the application host config file, in the app worker process entry.