question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blazor WASM ignores the Base Href when trying to fetch hot-reload script

See original GitHub issue

Is 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 /.

image

Expected Behavior

Debugging with a base href set works as it did in .NET 5.0.

Steps To Reproduce

  1. Create a new Blazor WASM application.
  2. Change the base href.
  3. Attempt to debug the project.
  4. The application will fail to load because it fails to find the hot reload script.
image
  • 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:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mkArtakMSFTcommented, Aug 3, 2022

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!

1reaction
keenamcommented, Jul 11, 2022

@gfs

It’s in the launchSettings.json I will update more info to be clearer.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found