Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blazor WebAssembly dotnet watch run --pathbase=/ doesn't work in .NET 8 #52294

Closed
1 task done
MaciekWin3 opened this issue Nov 22, 2023 · 5 comments · Fixed by dotnet/sdk#37285 or dotnet/sdk#39618
Closed
1 task done
Assignees
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) triaged
Milestone

Comments

@MaciekWin3
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hi, after the latest update to .NET 8, I discovered that the --pathbase flag is not working as it should. In the previous version, the app was served from the specified path, but in the new version, it is being ignored. I am using this option to debug my Blazor Extension in Azure DevOps as I need to specify a different path than the default one. The command I am using is:

dotnet watch run --pathbase=/dist

Then the app is served from /dist folder, and I can access my app and debug easily using hot reloading. At the root level, I get this message: "The server is configured only to handle request URIs within the PathBase '/dist'." On .NET 8, this flag is simply ignored, and the app is served from the default path.

Expected Behavior

I expected the app to run from specified path with the dotnet watch run --pathbase=path command after updating to .NET 8, like it did before. But now, the flag isn't working, and the app runs from the default path instead.

Steps To Reproduce

To reproduce the issue, launch a Blazor WebAssembly project using the command dotnet watch run --pathbase=/dist and observe whether the application is served at the specified path ('/dist' in this case).

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-blazor Includes: Blazor, Razor Components label Nov 22, 2023
@mkArtakMSFT
Copy link
Member

@tmat is this something you've potentially changed? I don't recall us making any changes in this area during .NET 8.

@mkArtakMSFT mkArtakMSFT added investigate area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) and removed area-blazor Includes: Blazor, Razor Components labels Nov 22, 2023
@afouadr
Copy link

afouadr commented Nov 26, 2023

Working:
dotnet run --pathbase=path

Not working:
dotnet watch --pathbase=path
dotnet watch run --pathbase=path

@mkArtakMSFT mkArtakMSFT added this to the .NET 9 Planning milestone Dec 1, 2023
@ghost
Copy link

ghost commented Dec 1, 2023

To learn more about what this message means, what to expect next, and how this issue will be handled you can read our Triage Process document.
We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. Because it's not immediately obvious what is causing this behavior, we would like to keep this around to collect more feedback, which can later help us determine how to handle this. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact work.

@mkArtakMSFT mkArtakMSFT modified the milestones: .NET 9 Planning, 8.0.x Dec 1, 2023
@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. and removed investigate labels Dec 1, 2023
@tmat
Copy link
Member

tmat commented Dec 2, 2023

Hot Reload is disabled when running the above command line with SDK 7:

>dotnet watch --verbose run --pathbase=/dist
dotnet watch ⌚ Did not find a HotReloadProfile or running a non-default command. Watching with legacy behavior.

We no longer disable it with SDK 8.

A workaround is to explicitly disable Hot Reload --no-hot-reload like so:

dotnet watch run --no-hot-reload --pathbase=/dist

@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@KenDRhyD
Copy link

I ran into this recently. I have .Net 7 Blazor app that is working on my MacOS system (via VSCode), and I attempted to update to .Net 8 by installing the 8.0.2 SDK and then changing the csproj file to update the framework and WebAssembly versions, and I was getting the same error message.

So I deleted the bin and obj folders completely and tried again and found that a "dotnet run" allows the "https://localhost:7035/" URL to invoke my code, but a "dotnet watch" reports the "The server is configured only to handle request URIs within the PathBase '/SMaLL'." error! And is I append "/SMaLL" to the URL then all resources report 404 error!

At least I can use the run command, but it is a pain to have to kill and restart with each code change, as I was able to use watch before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI bug This issue describes a behavior which is not expected - a bug. feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) triaged
Projects
Status: Done
6 participants