Search code examples
asp.net-mvcwin32-process

Scheduling console app from Global.asax ASP.NET


I have mail service that runnable as standalone console app. How I can schedule launching this service from Global.asax code?


Solution

  • This is not a very good idea. You do not want to start long-running processes in your app pool because if they crash, then w3wp.exe crashes and your site goes down. Instead, consider installing the service as a windows service. You can then check the service is running in your code, and, if not, try and start it. There are other options though. This http://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx should give you some inspiration.