Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS background process

Tags:

c#

.net

asp.net

iis

I have IIS server which runs few WCF REST services I created. Now I need to add some kind of process that will run on the server and do some work for me once in a while.

I guess the IIS should initiate some kind of a background process or something, but I'm not sure what is the technology I should use in this case?

like image 949
Ido Avatar asked Feb 01 '26 20:02

Ido


2 Answers

After reading at least three other similar questions, it appears the best practice is to avoid running background threads and allow a windows service app to do the processing. You could drop rows into a database table or append a line to a file to start the windows service work.

See any of these threads...

Can I use threads to carry out long-running jobs on IIS?

What are some best practices for managing background threads in IIS?

like image 107
Ben Gripka Avatar answered Feb 04 '26 09:02

Ben Gripka


As an alternative to Windows Task Scheduler, as mentioned by others, you could also:

In your global.asax file, in your application_start() method, you can spin up a new Thread to do whatever you want, and shut it down in the application_end() method.

like image 31
CodingWithSpike Avatar answered Feb 04 '26 09:02

CodingWithSpike