简体   繁体   中英

Correct way to start back ground work ASP.NET MVC 5

I'm building a ASP.NET MVC 5 web page currently. It's worth noting I'm fairly new to ASP.NET itself, prior to this I've only dealt with windows desktop applications.

My question is I'm unsure where to start my recurring background work. This work fires checks and updates to the MySql database on the server every few seconds. Currently I'm starting these checks just by adding a start method in the RouteConfig.cs class which I know is the wrong way to do it, just a quick hack while I search for the correct method. Where should I be starting this background work which should be kicked off as soon as the web page is available not when it's first searched for via the browser by a user?

This brings me to another question, a lot more work seemingly but would it be a better/more standard solution to write the background work as a windows service and establish a sort of interface between the web page front end and the windows service?

搜索Quartzin程序包管理器,它是.net的最佳计划

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM