-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Using the standard blazor app created in Dot Net 7, I changed the URL path by adding UsePathBase("/SomePath") on the server and in the blazor client index.html. That all works fine in Dot Net 7. I can get to all pages including the "Fetch Data" by adding /SomePath to the end of the URL.
After migrating to Dot Net 8 - preview 6 it also worked.
Updateing to Dot Net 8 RC the "Fetch Data" url stops working when running from Visual Studio. This is the bug. An API call that blazor makes back to the server is not routing to the controller anymore. This code WILL work when I deploy it to production running under IIS. I think this is because IIS is stripping the "/SomePath" from the URLs before passing them to my project.
There is a "workaround". If I change the [Route("[controller]")] in the controller to [Route("SomePath/[controller]")] then the api call starts working again in Visual Studio. This code, however, wont work in production running under IIS.
Expected Behavior
After changing the base path for an ASP.net project running blazor in the client, an API calls made from blazor back to the server should route to the controller with just the [Route("[controller]"] defined on the controller
Steps To Reproduce
This repo: https://github.com/Mike-Wodarczyk/ExampleOfUsePathBase/tree/dotnet_8_rc
has the dot net 8 converted version that shows the bug. Navigate to the "Fetch data" page to see the issue.
The same code in the dot net 7 master branch: https://github.com/Mike-Wodarczyk/ExampleOfUsePathBase/tree/master
works.
Exceptions (if any)
No response
.NET Version
8.0-rc
Anything else?
No response