-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Open
Labels
Milestone
Description
Is there an existing issue for this?
- I have searched the existing issues
Describe the bug
Similar to #57843, but when I use MapGroup to map blazor endpoints to a different base path, I get the error:
InvalidOperationException: Unable to find the provided template '/blazor/'
In the blazor template, I replace
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(BlazorBasePath.Client._Imports).Assembly);
with
var groupBuilder = app.MapGroup("/blazor");
groupBuilder
.MapStaticAssets();
groupBuilder
.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(BlazorBasePath.Client._Imports).Assembly);
I suppose the first question is, is that a valid thing to do? The issue I mentioned above does it using UsePathBase, but it seemed better to do what I want with the newer MapGroup feature.
Expected Behavior
Blazor site loads in new base path
Steps To Reproduce
Repo: https://github.com/ptsoccer/BlazorBasePath
- Create new Blazor Web App with WebAssembly as the interactive render mode. Other render modes might also error out, but I need WebAssembly.
- Replace
app.MapStaticAssets();
app.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(BlazorBasePath.Client._Imports).Assembly);
with
var groupBuilder = app.MapGroup("/blazor");
groupBuilder
.MapStaticAssets();
groupBuilder
.MapRazorComponents<App>()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(BlazorBasePath.Client._Imports).Assembly);
in the generated template
- Run the website and browse to /blazor, you should get the error mentioned above.
Exceptions (if any)
No response
.NET Version
10.0.101
Anything else?
Microsoft.NETCore.App 10.0.1
Microsoft.AspNetCore.App 10.0.1