Blazor WASM ignores the Base Href when trying to fetch hot-reload script
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Describe the bug
The Hot-Reload script ignores the base href when being fetched resulting in a 404 if the base href is set to anything other than /
.
Expected Behavior
Debugging with a base href set works as it did in .NET 5.0.
Steps To Reproduce
- Create a new Blazor WASM application.
- Change the base href.
- Attempt to debug the project.
- The application will fail to load because it fails to find the hot reload script.
- It does not work in both project launch and IIS express launch modes - however in IIS mode you will get the error in the browser, in project launch mode it doesn’t get that far.
See https://github.com/gfs/BlazorWasmHotReloadFailure for an example project that demonstrates this behavior.
Exceptions (if any)
No response
.NET Version
6.0.101
Anything else?
Visual Studio Version 17.0.4
PS C:\Users\gstocco\GitHub\BlazorWasmHotReloadFailure> dotnet --info
.NET SDK (reflecting any global.json):
Version: 6.0.101
Commit: ef49f6213a
Runtime Environment:
OS Name: Windows
OS Version: 10.0.22000
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\6.0.101\
Host (useful for support):
Version: 6.0.1
Commit: 3a25a7f1cc
.NET SDKs installed:
6.0.101 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.13 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Changing the base URL of a Blazor WASM app
Ignoring number 3 above though, the app will start, and I can get to the correct place by manually adding /myapp to the...
Read more >How to fix Blazor WASM base path problems - elmah.io Blog
This post will show you how to fix a common problem when setting the application base path with Blazor WebAssembly.
Read more >Unable to use hot reload while debugging Blazor WASM ...
I have "Hot Reload on Save" checked. Pressing the new Hot Reload button doesn't seem to do anything. The browser refresh script is...
Read more >.NET 6 Blazor - Modifying stuff in head and base path ...
There is a well known issue with blazor in that there is a base href attribute in the HEAD. When running the site...
Read more >10 Blazor Features You Probably Didn't Know
Blazor is a cutting-edge framework for web development with .NET. In this blog, we'll explain the most important features you need to know ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We think this is fixed in the upcoming .NET 7 preview 7 release. Can someone please give it a try when it ships and let us know if this is still an issue? Thanks!
@gfs
It’s in the
launchSettings.json
I will update more info to be clearer.