Skip to content

Endpoint information available before calling UseRouting() #50393

Open
@kimbell

Description

@kimbell

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

We are updating applications to net7 and discovered problems serving static files. We have a Razor convention that maps any unknown url to /index. Using debug logging, we figured out that it didn't match any static file, and used the Razor convention instead.

Logging output:

1 candidate(s) found for the request path '/bundles/shell-bundle.es.js'
Endpoint '/Index' with route pattern '{*url}' is valid for the request path '/bundles/shell-bundle.es.js'
Request matched endpoint '/Index'
Static files was skipped as the request already matched an endpoint.

I have created a small repro. This works as excepted on net6, but fails on net7 and net8.
If I remove UsePathBase(), things seem to be working again.

Expected Behavior

It should be possible to use

  • Razor Convention
  • UsePathBase()
  • UseStaticFiles()

at the same time

Steps To Reproduce

https://github.com/kimbell/RazorStatics

Exceptions (if any)

No response

.NET Version

8.0.100-preview.7.23376.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-hostingIncludes HostingbugThis issue describes a behavior which is not expected - a bug.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions