Home ASP.net create infinite loop on application start to do work
Reply: 1

ASP.net create infinite loop on application start to do work

user2932688 Published in 2017-12-07 16:37:03Z

I need to do some work on periodic basis, like check some data in DB and make some calculations if needed and store them back to DB.

The question is how bad is it to start infinite look with some "sleep and do work" in separate thread on application start which would perform all required task periodically until pool shutdown?

What are the downsides? it feels for me like it may affect asp.net processing performance due to reusable/releasable concept of MVC resources, but I can't find any proof.

Would appreciate any links or hints, Thanks!

P.S. I realize that best place to do something like this is windows service but it introduce some difficulties with deployment on client environment and I am checking out for any other options if any.

Sea Charp
Sea Charp Reply to 2017-12-07 20:25:05Z

I would suggest you construct a simple Console App to do what you would like and then set a Scheduled Task to run the console app.

This is the method I have used to do maintenance utilities such as the one you are describing.

Otherwise, in an Asp.net app, the worker process could be reset, the host might have an Idle Timeout triggered. And generally I think it would be the wrong approach when a very simple console app will use the language you prefer and accomplish the same task.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.399497 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO