Repository navigation
Fix empty PathBase on first IIS in-process request after startup - #69398
Conversation
|
Thanks for your PR, @Souheyl7Gouadria. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
@dotnet-policy-service agree |
|
@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 |
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
|
/azp run aspnetcore-components-e2e |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
halter73
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
|
/backport to release/10.0 |
|
Started backporting to |
|
/backport to release/11.0 |
|
Started backporting to |
) (#69837) Co-authored-by: souheyl gouadria <[email protected]>
) (#69712) Co-authored-by: souheyl gouadria <[email protected]> Co-authored-by: William Godbe <[email protected]>
Fix empty PathBase on first IIS in-process request after startup
Make the IIS virtual path available before requests can be dispatched.
Description
IISHttpServer.StartAsyncregisters the native callbacks and then reads the virtual path fromHttpGetApplicationProperties(). A request dispatched between those two statements is built withPathBase = ""andPath = "/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 beforeRegisterCallbackswould reintroduce that problem.UseIIS()already callsHttpGetApplicationProperties()when configuring the host and copies values such aspwzBindingsinto internalIISServerOptionsmembers. This PR passespwzVirtualApplicationPaththrough the options the same way and removes the native call fromStartAsync. The virtual path is now set before any callback is registered, andStartAsyncno longer makes a native call that can throw.Fixes #69392