ispiro
ispiro

Reputation: 27693

What does IIS recycling wait for?

What I mean is that IIS recycles app domains, but tries to let pending requests finish while already starting a new one. What if all requests have responded, but there's a Task running, will the app get recycled immediately or will it get the same grace period as when a request hasn't responded yet?

Upvotes: 1

Views: 452

Answers (1)

Alex Terry
Alex Terry

Reputation: 2092

If you don't register the Task with the web app using HostingEnvironment.QueueBackgroundWorkItem, https://msdn.microsoft.com/en-us/library/dn636893(v=vs.110).aspx, then the app will only gracefully "shutdown" its own request threads. If you do add the Task to the queue, then it will try and wait for the Task to complete. However, the waiting period is not indefinite.

Scott Hanselman has a nice article on running async tasks.

https://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx

Upvotes: 2

Related Questions