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

dotnet watch WebSockets port configuration for HotReload #39608

Closed
sdykae opened this issue Jan 6, 2022 · 10 comments
Closed

dotnet watch WebSockets port configuration for HotReload #39608

sdykae opened this issue Jan 6, 2022 · 10 comments
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Milestone

Comments

@sdykae
Copy link

sdykae commented Jan 6, 2022

From https://github.com/dotnet/sdk/blob/1cbb60f4ad1a34415a8f360c90e92a70587bdb1b/src/BuiltInTools/BrowserRefresh/BrowserScriptMiddleware.cs#L49

We should configure static ports like this.
image

{
    "SuperHeroAPI": {
      "commandName": "Project",
      "dotnetRunMessages": true,
      "launchBrowser": true,
      "hotReloadEnabled": true,
      "hotReloadProfile": "aspnetcore",
      "launchUrl": "swagger",
      "applicationUrl": "https://localhost:7078;http://localhost:5055",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development",
        "ASPNETCORE_AUTO_RELOAD_WS_ENDPOINT": "wss://localhost:35871,ws://localhost:33863"
      }
    }

Then If you are a vscode remote developer you could just open those ports
image

@sdykae sdykae closed this as completed Jan 6, 2022
@sdykae sdykae reopened this Jan 6, 2022
@sdykae
Copy link
Author

sdykae commented Jan 6, 2022

Since
https://github.com/dotnet/sdk/blob/1cbb60f4ad1a34415a8f360c90e92a70587bdb1b/src/BuiltInTools/dotnet-watch/Filters/BrowserRefreshServer.cs#L49

There is no way to configure ws wss urls, ports for dotnet watch, Web client are configurable but server ones are random
image

@pranavkm pranavkm transferred this issue from dotnet/sdk Jan 18, 2022
@javiercn javiercn added 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) labels Jan 18, 2022
@mkArtakMSFT mkArtakMSFT added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Jan 20, 2022
@mkArtakMSFT mkArtakMSFT added this to the .NET 7 Planning milestone Jan 20, 2022
@ghost
Copy link

ghost commented Jan 20, 2022

Thanks for contacting us.

We're moving this issue to the .NET 7 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. 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 issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@jrmoreno1
Copy link

jrmoreno1 commented Jan 25, 2022

What determines whether Hot Reloads uses ws or wss?

@lonix1
Copy link
Contributor

lonix1 commented May 1, 2022

Did you find a workaround? Hot reload is unusable as it chooses a random port each time.

@asm-flairstech
Copy link

It would be impossible to configure this with CspOptions ConnectSources custom sources for trusted domains if ports are always generated randomly!

@asm-flairstech
Copy link

Also the domain doesn't have to be localhost, it could be something else

@ghost
Copy link

ghost commented Oct 6, 2023

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@Trystan-SA
Copy link

Trystan-SA commented Oct 26, 2023

The year is 2023, and Microsoft still hasn't added an environment variable to prevent its random WebSocket port allocation... 🤦‍♂️

@mkArtakMSFT
Copy link
Member

Closing as a dupe of #39765

@mkArtakMSFT mkArtakMSFT closed this as not planned Won't fix, can't repro, duplicate, stale Dec 15, 2023
@mkArtakMSFT mkArtakMSFT added the ✔️ Resolution: Duplicate Resolved as a duplicate of another issue label Dec 15, 2023
@ghost ghost added the Status: Resolved label Dec 15, 2023
@sdykae
Copy link
Author

sdykae commented Dec 16, 2023

@mkArtakMSFT you are closing in favor of a resent issue? why? that is the dupe not this one

@ghost ghost locked as resolved and limited conversation to collaborators Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-commandlinetools Includes: Command line tools, dotnet-dev-certs, dotnet-user-jwts, and OpenAPI enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-dotnetwatch This issue is related to the dotnet-watch command-line tool (now external) ✔️ Resolution: Duplicate Resolved as a duplicate of another issue Status: Resolved
Projects
None yet
Development

No branches or pull requests

7 participants