Skip to content

Fix empty PathBase on first IIS in-process request after startup - #69398

Merged
halter73 merged 1 commit into
dotnet:mainfrom
Souheyl7Gouadria:iis-inprocess-pathbase-startup-race
Oct 7, 2026
Merged

halter73 merged 1 commit into
dotnet:mainfrom
Souheyl7Gouadria:iis-inprocess-pathbase-startup-race

Conversation

@Souheyl7Gouadria

Copy link
Copy Markdown
Contributor

Fix empty PathBase on first IIS in-process request after startup

Make the IIS virtual path available before requests can be dispatched.

Description

IISHttpServer.StartAsync registers the native callbacks and then reads the virtual path from HttpGetApplicationProperties(). A request dispatched between those two statements is built with PathBase = "" and Path = "/myapi/...", so nothing routes and it returns 404. For an app hosted under a virtual path, this is typically the request that cold-starts the app pool. It is a regression from 9.0, where the constructor read the virtual path.

That ordering came from #60399. It moved the native call out of the constructor and after RegisterCallbacks, because the call can throw when native is shutting down during startup. Moving the call back before RegisterCallbacks would reintroduce that problem.

UseIIS() already calls HttpGetApplicationProperties() when configuring the host and copies values such as pwzBindings into internal IISServerOptions members. This PR passes pwzVirtualApplicationPath through the options the same way and removes the native call from StartAsync. The virtual path is now set before any callback is registered, and StartAsync no longer makes a native call that can throw.

Fixes #69392

Copilot AI lite review requested due to automatic review settings September 18, 2026 20:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions github-actions Bot added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Sep 18, 2026
@dotnet-policy-service dotnet-policy-service Bot added the community-contribution Indicates that the PR has been added by a community member label Sep 18, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Thanks for your PR, @Souheyl7Gouadria. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@Souheyl7Gouadria

Copy link
Copy Markdown
Contributor Author

@Souheyl7Gouadria please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@Souheyl7Gouadria

Souheyl7Gouadria commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@BrennanConroy could you review this when you have time? It changes the ordering introduced in #60399.

The only failing check is the Blazor E2E test ServerVirtualizationTest.AnchorMode_End_AppendAtMidList_DoesNotAutoScroll, which also fails on main. Everything else is green.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime.
To make sure no conflicting changes have occurred, please rerun validation before merging. You can do this by leaving an /azp run comment here (requires commit rights), or by simply closing and reopening.

@dotnet-policy-service dotnet-policy-service Bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Oct 2, 2026

@halter73 halter73 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@halter73

halter73 commented Oct 7, 2026

Copy link
Copy Markdown
Member

/azp run aspnetcore-components-e2e

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@halter73 halter73 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@halter73
halter73 enabled auto-merge (squash) October 7, 2026 20:21
@halter73
halter73 merged commit 4f8bb2b into dotnet:main Oct 7, 2026
46 of 51 checks passed
@halter73

halter73 commented Oct 7, 2026

Copy link
Copy Markdown
Member

/backport to release/10.0

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Started backporting to release/10.0 (link to workflow run)

@halter73

Copy link
Copy Markdown
Member

/backport to release/11.0

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/11.0 (link to workflow run)

wtgodbe pushed a commit that referenced this pull request Oct 15, 2026
wtgodbe added a commit that referenced this pull request Oct 15, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — 6aeecab9 Deployed Sep 19, 2026 by dotnet-policy-service[bot] via conclusion #1416
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member feature-iis Includes: IIS, ANCM pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun

Projects

None yet

4 participants