0

I have Win Server 2016 with IIS, all updates applied as of this date. During updates to the sites running there, I put an app_offline.htm file in the app folder to bring the app pool down.

For a single specific app, putting the file there won't stop the application. I need to open task manager, kill it once, it then restarts (with the app_offline file there), the website remains opening as normal, then I close it the second time and then it will remain stopped for the update to occur.

This app is setup for a single worker, and no overlapped workers, that is, the new process will start only after the first one is finished. This specific app runs some code during shutdown that may take a few seconds to run, that could explain why it doesn't shutdown immediately, but doesn't explain why after killing the pool process, it will start again even with the file there.

Any ideas?

Natan
  • 223
  • 1
  • 3
  • 9
  • What you observed is the desired behavior. `app_offline.htm` is a feature of ASP.NET which prevents the AppDomain object from processing ASP.NET requests. Thus, it won't affect IIS at all, and IIS worker process should simply work. You should not wish it "to bring the app pool down". – Lex Li Apr 16 '18 at 19:29
  • @LexLi What you say is not what I see documented everywhere. Please provide some documentation to back that up. – Natan Apr 16 '18 at 19:48
  • Scott Guthrie announced it years ago, https://weblogs.asp.net/scottgu/426755 – Lex Li Apr 16 '18 at 19:49
  • @LexLi exactly, and what is written there is exactly what I'm expecting. Specifically: "if you place a file with this name in the root of a web application directory, ASP.NET 2.0 will shut-down the application, unload the application domain from the server, and stop processing any new incoming requests for that application". You're saying that the application not shutting down is expected behavior. – Natan Apr 16 '18 at 20:10
  • The term "app pool" is not equal to "application". The application pool and worker process must be there, or there is nothing to serve `appoffline.htm` to web browsers. – Lex Li Apr 16 '18 at 20:13
  • @LexLi you're trying to discuss something else, while the problem persists, and is obviously a problem because it works differently than what the documentation says and differently from all the other applications in the same server. So, unless you have a solution, there is no point in discussing this. This is not the desired behavior. – Natan Apr 17 '18 at 14:31
  • You might enable ASP.NET ETW tracing to show what exactly happens under the hood (would be much clearer than your limited description above), https://blogs.msdn.microsoft.com/tess/2008/11/06/troubleshooting-appdomain-restarts-and-other-issues-with-etw-tracing/ Whether the behavior around `app_offline.htm` meets your expectation or not, the trace would tell the truth. – Lex Li Apr 17 '18 at 14:37

1 Answers1

0

The problem was the default shutdown limit for the app, which is documented to be 10 seconds by default, but was obviously taking much longer. By explicitly setting the value in the web.config, the application shuts down after at most 10 seconds, which leaves me to investigate why the application is not shutting down before, but at lease the app_offline.htm works as expected with this change:

<system.webServer>
  <aspNetCore ... shutdownTimeLimit="10" />
</system.webServer>
Natan
  • 223
  • 1
  • 3
  • 9