Open JamesHill3 opened 3 years ago
@vijayrkn Can you please take a look? Is this supported?
Since app_offline is a static file, you should be able to add any app_offline content to the root of your project at the time of publishing. This should replace the one added by MSDeploy. This blog has details on handling it many ways - https://tahoeninjas.blog/2018/11/08/automatically-make-your-asp-net-web-application-offline-while-deploying-using-web-deploy-in-visual-studio-2017/
Does this help?
@vijayrkn It might help if I were publishing to a network folder, but I've not been able to get this to work when publishing to a remote server using Web Deploy (I've not tried a network folder like the page demonstrates).
Still, I think there is a larger issue. Manually adding app_offline.htm to the root of the project right before publishing _does _not__ override the one added by MSDeploy. It's completely ignored. I've tried App_Offline.htm in case it is case sensitive. No luck. I've set the file to always copy to output directory. Nothing. MSBuild writes its ugly blank page and under construction title regardless.
Also keep in mind that the blog post you referenced has to jump through some hoops to copy the file to the root while renaming because simply putting a file name App_Offline.htm prevents the project from building.
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.
Just checking in. Any progress on this?
While at it, could the default file in Visual Studio be improved with something along the lines of:
<meta http-equiv="refresh" content="120">
--
That would solve 90% of what I need, the remaining 10% is styling/theming, and this is solvable if custom file can be provided more easily (then unreliable hacks like this).
Also running into this issue when using Web Deploy. app_offline.htm in the project root is completely ignored in favor of the stock one. I noticed on Stack Overflow people reported that it does (or did) work if you delete existing files. That wouldn't work for my use case.
I don't get why this is so dumb and simple feature isn't implemented yet, it's a feature that a lot of users requested along years... I mean, why is so hard to check if there's App_Offline.htm in the root project use that, if not use the ugly blank under construction?
It would be so useful if we could supply our own app_offline file.
I have gone as far as replacing the default with my own but it too gets overridden back to default.
Is there something we can do to put this into the works?
Anyone coming here for this, make sure to vote it up (thumbs up on issue above, not this comment) so it's clear it's in demand.
I love ASP.NET CORE and have been using it since the .NET CORE RC2 days. But every once in a while, I hit something where I simply can't believe that the feature doesn't exist. Today is that day, again.
No professional organization using MSDeploy to deploy their ASPNET.NET 6 website wants to see a generic site down message while the site is updating.
How is it possible that in 2023, a custom app_offline.htm in the root of my web project can't be used when EnableMsDeployAppOffline is true in a .pubxml file? What? That's simply crazy.
This github issue would have far more upvotes if devs could find it. Please modify the title so that it includes "ASPNET Core WebDeploy Custom app_offline.htm" in the title.
And please, please, prioritize a fix for this. For those of us championing .NET with clients, it's embarrassing. Put yourself in our place, can you imagine telling a client that their customers must see a generic site down message while MSDeploy updates the site?
I've been constantly checking in on this for...oh let's see now...the past 10 years. I remember back in VS2010 or VS2012 or whenever it was when they finally created the Web Deploy feature. But even after that, it still took them until Web Deploy 3.X just to think to include the EnableMsDeployAppOffline
setting. Can you imagine having a built-in feature for IIS where this special app_offline.htm
file automatically shuts down the application, bypasses all the modules, serves up this offline file, and even restarts the entire application once removed, yet they didn't even think to leverage it until their THIRD attempt at this Web Deploy concept. To add insult to injury though, even after finally adding this setting so that...oh you know...an application can actually gracefully shutdown and not keep the DLLs locked...WHICH SHOULD BE A BASIC FEATURE OF ANY UPDATE PROCESS...they still to this day, 10 years later, never had the thought cross their mind to allow us to customize this file. I mean, who would want to customize the offline webpage of their application? Nobody wants that! (sarcasm) Something as simple as checking the root of the project content during deployment? Nah. Something as simple as another setting in the pubxml file to let us specify a custom file path for this file? Nah. Over a decade of people requesting this EXTREMELY SIMPLE feature? Nah. They literally do not give a shit.
So the only recommendation I have for anyone reading this is to just not try to customize app_offline.htm
at all. Yep that's right, if a feature isn't going to be completely workable from end-to-end you have to come to the realization that it's not a useful feature. So this means Web Deploy is a waste of time in terms of actually having a proper update page during the process. You should still keep the EnableMsDeployAppOffline
setting enabled so your DLLs aren't locked, but rather use it with a deployment slot instead.
If you're updating an app that takes a while to push, or more importantly receives a heavy amount of traffic, then you don't even want to worry about customizing your app_offline.htm
file because you shouldn't even be taking your application offline in the first place. Instead this is the proper solution that you're looking for: https://www.youtube.com/watch?v=2_tnbmnPAUk If you're just updating a very basic app or one that doesn't receive a lot of traffic you're pretty much shit-out-of-luck. Just keep using Web Deploy with the EnableMsDeployAppOffline
setting and move on with your life.
@vijayrkn It's been 2.5 years since this request was made. Is this simply going to go unanswered? A quick google search will show identical requests going back 12 years. Are we asking too much here?
Describe the solution you'd like
Please, for the love of all that is good in the world, let us use a custom app_offline.htm when publishing.
Additional context
I use web deploy.
The user voice from 2012 was taken down, but a quick search on StackOverflow and Google reveal troves of people scouring the depths of the Internet for a solution from 2009 onward.
Motivational context