Skip to content

UseStaticFiles behavior when accessed through branched IAppBuilder. #25864

Answered by Tratcher
spencer741 asked this question in General
Discussion options

You must be logged in to vote

Map makes a specific change to the request that other APIs like MapWhen can't. It trims the matched portion of the request.Path and moves it to request.PathBase. Most middleware ignore the PathBase and only look at the remaining Path.

Why this would mess up UseSpaStaticFiles is a good question, but as a rule, nothing inside any of these Map* Actions should ever reference the outer IApplicationBuilder. That's the same as not putting it inside the Map Action at all.

Similarly, I don't think that MapWhen is doing anything, you never reference myappsBuilder.

Clean up the sample to remove the MapWhen and nest UseSpaStaticFiles and then we can start tracking down why it doesn't work as expected.

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@spencer741
Comment options

@Tratcher
Comment options

@spencer741
Comment options

@Tratcher
Comment options

@spencer741
Comment options

Answer selected by spencer741
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants