Skip to content

[release/11.0] Fix empty PathBase on first IIS in-process request after startup - #69837

Merged
wtgodbe merged 1 commit into
release/11.0from
backport/pr-69398-to-release/11.0
Oct 15, 2026
Merged

wtgodbe merged 1 commit into
release/11.0from
backport/pr-69398-to-release/11.0

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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.StartAsync registers native callbacks before reading the application's virtual path. Registration enables ANCM to dispatch requests, so a request constructed during that window sees an empty PathBase and an unsplit Path. For an application deployed at /myapi, /myapi/v1/ping consequently fails to match the /v1/ping endpoint.

Pass pwzVirtualApplicationPath through an internal IISServerOptions property using the existing native configuration snapshot in UseIIS(). The server resolves these options during construction, before callback registration. Remove the redundant native property query from StartAsync rather 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 IStartupFilter and 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?

  • Yes
  • No

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

  • High
  • Medium
  • Low

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

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

No package, dependency, project, shared-framework composition, or native binary layout changes. The new option is internal.

@wtgodbe wtgodbe added the Servicing-approved Shiproom has approved the issue label Oct 15, 2026
@wtgodbe
wtgodbe merged commit 50f709d into release/11.0 Oct 15, 2026
35 checks passed
@wtgodbe
wtgodbe deleted the backport/pr-69398-to-release/11.0 branch October 15, 2026 01:08
@dotnet-policy-service

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Servicing-approved Shiproom has approved the issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants