Prevent 503s from IIS after IISNativeApplication gets finalized #59910
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This was brought to my attention by dotnet/AspNetCore.Docs#34492, but @Tratcher had already filed an issue for it. Both of these are based on the investigation at https://techcommunity.microsoft.com/blog/iis-support-blog/asp-net-core-503-server-has-been-shutdown/3830338.
@Tratcher's suggestion was to detect this situation and provide a better error, but so long as we haven't actually started the server, I don't think this needs to be an error case at all. We could consider making the server restartable, but I think that would require more drastic changes, and that's not something people try to do often.
What's more common is code like the following:
While I would never recommend this, and would advocate for creating your own ConfigurationManager or
ConfigurationBuilder
from the appropriate source instead, this should not break IIS.Fixes #48457