9

In ASP.NET, when you modify web.config file, IIS will recycle the app pool. Now, I am storing my configs in the DB instead of web.config and would like to simulate a similar behavior. My current solution is to call HttpRuntime.UnloadAppDomain().

The description on MSDN says:

Terminates the current application. The application restarts the next time a request is received for it.

My question here is: Does it abruptly terminate all in-flight requests? If not, what happens to requests that arrive during the time the appdomain gets reloaded? Or the reload time is insignificant?

I tried looking around but cannot find any information regarding this.

Thanks :)

Tu Hoang
  • 4,104
  • 12
  • 30
  • 46
  • When "terminate" is used, you should not expect a graceful exit and the requests should have been dropped. Of course you should do some experiments to validate that. – Lex Li Apr 11 '14 at 03:49
  • 4
    The [documentation](http://msdn.microsoft.com/library/system.web.httpruntime.unloadappdomain.aspx "HttpRuntime.UnloadAppDomain Method") is not very clear on that. Fortunately, [you can see for yourself what it does](http://referencesource.microsoft.com/System.Web/a.html#791f8528c30d0721). – Paulo Morgado Apr 11 '14 at 10:04
  • @PauloMorgado good call. From the calls it does, looks like it tries to stop the app the application gracefully and waits some time until it times out, just like when you do it from IIS. – Natan Aug 29 '14 at 21:45

0 Answers0