-
Notifications
You must be signed in to change notification settings - Fork 10.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shadow Copy on IIS when new version of SDK is installed fails. #48296
Comments
Updating the title because you'll get more traction if people don't think this is about .NET Framework. 😉 |
Do you want to take a look at this one, @mgravell? @BrennanConroy might have some helpful background. |
A quick follow up - I think this may not be isolated to just deployments and version updates, but restarts after a deploy with Shadow copy enabled. It seems there is some timing sensitive issue is causing the Application Pool to fail to properly startup the .NET runtime. In all cases when it fails, cleaning out the shadow deploy folder makes it work again. A redeploy won't fix it, even a full IISRESET or individual Application Pool restart also will not fix it. Once bad the only thing that seems to work is to turn off shadow copy deploy or clear out the shadow deploy folder. I can't seem to pinpoint what causes the failure when it occurs. It seems almost random. Failure rate seems to be one out of 5 deploys fails (same error). |
I've been battling this issue since installing the .net 9 hosting bundle. I have multiple sites hosted in IIS using shadow copy that randomly fail when their app pool's are automatically recycled or when deployed. None of these sites are currently targeting .net 9. Previous to installing the bundle all of the sites worked with shadow copy without issue. Diagnostic log
What I've done:
From the timing of the copy starting to the |
Make sure you're using a dedicated shadow copy directories for each application. I had this happen with .NET 8 when running a single shared shadow copy folder. Even though SC creates separate folders for each app, when they all used the same base folder for some reason apps would frequently fail to load with ANCHM loading errors. @tim-heide Your samples look like you're using a single shadow copy folder (/shadow) for multiple sites. Instead Use:
as the base folder you provide in the configuration. FWIW, my .NET 9 deploy went without a hitch after the .NET 8 changes a year ago and I have a mixed bag of about 10 .NET apps running on this server with only a few updated to 9.0 at the moment - but they all start without issues. |
Thanks for the reply Rick. Each website already has its own folder below the shadow root corresponding to its name. For example
I'll try tweaking the name of the folder see if that makes any difference. I had 12 sites fail across three servers last night. Not filling me with confidence for taking time off for Xmas haha. Good to hear .net 9 went without a hitch for you. I'm just waiting on a dependency before I can migrate mine across. |
You've probably done this but just to be sure:
Old artifacts can cause problems - although if you've started/stopped a bunch of times that likely is not the problem. Finally look in the event log and see what the actual failure error message is. It's possible your app is choking on something else during startup. |
Stopped / started and deleted shadow folders multiple times but not the entire thing. Will try that. Yeah unfortunately the lack of a helpful error message in the event log is my main issue. This is the extent of it:
Logging to stdout or debug file is no more verbose unfortunately. |
That sounds like an invalid setting in the When I had issues in 8.0 I had these same frustrations - I would change things, then change them back and get completely different behavior at the time which is frustrating as heck. The thing that used to work reliably at that time was, to remove shadow copy from each site one at a time, then add it back after the site ran without. This also makes sure you don't have some other issue that's causing the startup failure. Luckily this 9.0 transition worked with no issues for me... maybe I got lucky 😄 |
Yeah just read your blog post about it. Sounds very similar to what I am going through! I remember this happened to me when I installed .net 8. I can't really remember how it resolved though. I think all it took was a server bounce but it could have been one of 50 things I tried. I wish I had written down what I did to get it working haha. It has been super solid since then until .net 9 install. Sites work great without shadow copy. Start quick if recycled just not so nice for a new deployment. I think that will be my only option until I can move to 9 and try again. |
It was the elusive I first enabled it in .net 7 as I was trying to get the old shadow folders cleaned up after a deployment instead of piling up. This setting appears to be causing intermittent failures in .net 9 and also redundant as old folders are cleaned up automatically. Sites seem to be starting up quicker than with it enabled in .net 8 too. Happy days! |
Dropping a potentially helpful comment on here to expand on the last one here. I wrote up #48233 a while back. Long story short, shadow copy has a bug that seemed to crash the site if directory structure changed. It seemed like the only workaround was to use Fast forward to today and we upgrade to .NET 9. We start randomly (maybe once or twice a week) getting some hard crashes that look exactly like the above: First off, the shadow copy bug i reported should be fixed in .NET 9, so the work around should no longer be necessary, but we didn't think to turn it off after upgrade. Another feature was introduced in .NET 9: A fix for 503s during app recycle in IIS. That fix waits one second for things to finish up to cut down on 503s. Interestingly, the event log showed an informational message 1 second after the hard crash of the site that looked something like:
So my thought on the possible problem (though I could be way off):
Still not sure I can entirely explain it, but it feels like that might be close. I disabled the setting as well, but only time will tell whether that worked. Currently monitoring it. |
Is there an existing issue for this?
Describe the bug
I can't duplicate this since it's a version update issue.
Scenario:
App failed to run with error in the IIS ASP.NET Core Hosting Module:
Eventual Solution:
By chance I tried the latter and that worked - the app now runs consistently.
It appears that the Shadow Copy folder incorrectly was caching some dependencies when the .NET/ASP.NET Runtimes were updated. I would expect each new Shadown copy 'instance` to get a new and self-contained environment, but by the sound of it something from that folder was cached and not using the newly installed runtime version.
Expected Behavior
Shadow Copy folder should not cause problems when new runtime is installed.
Steps To Reproduce
Not easily reproducable without uninstalling reinstalling runtimes.
Exceptions (if any)
No response
.NET Version
7.0.5
Anything else?
The text was updated successfully, but these errors were encountered: