Skip to content
This repository was archived by the owner on Nov 1, 2018. It is now read-only.

Support app_offline.htm #81

Closed
Tratcher opened this issue Feb 3, 2016 · 16 comments
Closed

Support app_offline.htm #81

Tratcher opened this issue Feb 3, 2016 · 16 comments

Comments

@Tratcher
Copy link
Member

Tratcher commented Feb 3, 2016

  • Deployer uploads app_offline.htm (case insensitive)
    • HPH serves app_offline.htm for any new incoming requests
  • HPH signals process shutdown (SignalR, WebSockets) (opt-in web.config: signalShutdown=true ?)
  • HPH waits for process to end with timeout if shutdown signal was requested&sent
  • Deployer needs to find out when the process is down / the files are unlocked
    • Retry loop on deletefile?
  • Deployer uploads new files
  • Deployer deletes app_offline.htm
  • HPH restarts the back-end process

Initial HPH work completed by end of Feb.
Deployer developed in parallel
Update publish-iis to add signalShutdown to the web.config

RE: aspnet/Hosting#141
@sayedihashimi

@Tratcher
Copy link
Member Author

Tratcher commented Feb 3, 2016

Hosting already supports Ctl+C and Ctl+Break.

@muratg
Copy link
Contributor

muratg commented Feb 4, 2016

Cool, thanks for checking!

@muratg
Copy link
Contributor

muratg commented Feb 4, 2016

Note for HPH side: CreateProcess will need to be called the right way with the flag CREATE_NEW_PROCESS_GROUP as specified in the msdn article

@guardrex
Copy link
Contributor

guardrex commented Feb 4, 2016

HPH serves app_offline.htm for any new incoming requests

HPH will be checking periodically for the presence of this file? I wish checking for the file file could be disabled in options for app.UseIISPlatformHandler().

@moozzyk
Copy link
Contributor

moozzyk commented Feb 4, 2016

@guardrex - why?

@guardrex
Copy link
Contributor

guardrex commented Feb 4, 2016

Perf concern ... How often does HPH have to check for the file? Is it inconsequential (i.e., milliseconds spent every several seconds ... i.e., that's no "concern" to be concerned about)?

@PureKrome
Copy link

@moozzyk

  • Some people might never want to push up an app_offline.hml so why waste the cpu check(s) (yes, micro opt).
  • Security. disable the option for a rogue person to throw the site offline by just uploading a single file with some hacker message, etc.

edit: @guardrex beat me by about 20 secs. ha doh.

@moozzyk
Copy link
Contributor

moozzyk commented Feb 4, 2016

@guardrex - Perf concern - I would assume that platform handler will not poll but be notified about changes. Not sure how much overhead it would add but IIS already monitors changes to the web.config file and I don't think this is causing perf issues.

@PureKrome -

Security. disable the option for a rogue person to throw the site offline by just uploading a single file with some hacker message, etc.

I guess this is always true - overwriting the .exe containing the app will have the same effect and you can take the site down just by overriding the web.config file.

@guardrex
Copy link
Contributor

guardrex commented Feb 4, 2016

Perf concern - I would assume that platform handler will not poll but be notified about changes.

Perfect! ...... concern withdrawn.

@Tratcher
Copy link
Member Author

Tratcher commented Feb 4, 2016

@guardrex On a related note, HPH is configured exclusively via the web.config. There's nothing you/we can do once the app has launched. UseIISPlatformHandler and similar just consume things provided by HPH.

@guardrex
Copy link
Contributor

guardrex commented Feb 4, 2016

@Tratcher I see. Just asking. I'm good.

@sayedihashimi
Copy link

Deployer needs to find out when the process is down / the files are unlocked
Retry loop on deletefile?

When VS is used we will pass the appoffline flag to MSDeploy. We will also pass a flag to retry 5 times by default. So the flow is that msdeploy will drop the app_offline.htm file, start uploading files from the client, and then delete the app_offline.htm. If there is a problem during the publish it will retry automatically. In some cases if the web server is taking too long to respond the publish operation may be blocked. I've never heard a report of this though. I think in most cases the app does go offline in time for one of the retries to continue.

cc @vijayrkn @bruceyclee

@haydenmc
Copy link

👍

@Tratcher
Copy link
Member Author

This as been fixed in AspNetCoreModule v0.8: #105.

@derekgreer
Copy link

For anyone who happens upon this thread in the future, it should be noted that there are versions of the .Net Core Module that only respect all lower case "app_offline.htm". (see comments here: https://docs.microsoft.com/en-us/aspnet/core/hosting/aspnet-core-module). There is mention of this being fixed in the latest version, but it isn't clear which version.

@shirhatti
Copy link
Contributor

It was fixed in Version 1.0.1971.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants