Repository navigation
[release/11.0] Fix empty PathBase on first IIS in-process request after startup - #69837
Merged
Merged
Conversation
github-actions
Bot
requested review from
BrennanConroy,
SamMonoRT and
halter73
as code owners
October 14, 2026 21:01
BrennanConroy
approved these changes
Oct 14, 2026
Contributor
|
Hi @github-actions[bot]. This PR was just approved to be included in the upcoming servicing release. Somebody from the @dotnet/aspnet-build team will get it merged when the branches are open. Until then, please make sure all the CI checks pass and the PR is reviewed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #69398 to release/11.0
/cc @halter73 @Souheyl7Gouadria
Fix empty PathBase on first IIS in-process request after startup
Initialize the IIS virtual path before requests can be dispatched.
Description
IISHttpServer.StartAsyncregisters native callbacks before reading the application's virtual path. Registration enables ANCM to dispatch requests, so a request constructed during that window sees an emptyPathBaseand an unsplitPath. For an application deployed at/myapi,/myapi/v1/pingconsequently fails to match the/v1/pingendpoint.Pass
pwzVirtualApplicationPaththrough an internalIISServerOptionsproperty using the existing native configuration snapshot inUseIIS(). The server resolves these options during construction, before callback registration. Remove the redundant native property query fromStartAsyncrather than moving it back before registration, preserving the shutdown-race protection introduced by #60399.This is an unchanged backport of the three-file fix merged in #69398. It does not include the separate, pre-existing server-address publication issue tracked in #69704.
Fixes #69392
Customer Impact
ASP.NET Core 10.0 applications hosted in-process under an IIS virtual application path can intermittently return 404 for the request that cold-starts the application, including after deployment or an app-pool idle timeout. Subsequent identical requests route correctly. This can affect any application using that deployment configuration; the reporter observed it in two applications.
The reported workaround uses an
IStartupFilterand reflection over internal IIS server state to repair the request path before routing. Although it mitigates the failure, it depends on implementation details and requires application changes. Correct framework initialization restores the working 9.0 behavior without requiring that workaround.Regression?
Regression from ASP.NET Core 9.0. Commit
512209d2ccd8df506b3c302385fa840ff09d76d7(#60399) introduced the ordering change during 10.0 development. It is absent from 10.0 Preview 1 and present in Preview 2. The failure was reproduced on 10.0.12; the same controlled startup interleaving succeeds on 9.0.20.Risk
The change only moves the source of the virtual-path value into the existing startup configuration-to-options flow. It adds no public API, dependency, native ABI, packaging change, or per-request native call. Request path splitting and native shutdown callbacks are unchanged. Reusing the already-captured native snapshot removes a shutdown-sensitive query instead of reinstating it in the server constructor. The fix has already merged to main.
Verification
Packaging changes reviewed?
No package, dependency, project, shared-framework composition, or native binary layout changes. The new option is internal.