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.

`dotnet watch` WebSockets port configuration for HotReload

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
asm-flairstechcommented, Jul 8, 2022

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

0reactions
asm-flairstechcommented, Jul 8, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet watch command - .NET CLI
The dotnet watch command is a file watcher that runs a dotnet command when changes in source code are detected.
Read more >
.NET 6 Hot Reload and "Refused to connect to ws ...
NET 6 Hot Reload and "Refused to connect to ws: because it violates the Content Security Policy directive" because Web Sockets.
Read more >
VS 2022 Hot Reload - web socket fails to open in ...
js file to my page, which attempts to open a websocket connection to a localhost port on machine, but it always fails. I...
Read more >
What's New in ASP.NET Core in .NET 6
NET Hot Reload is enabled whenever you run an ASP.NET Core app using dotnet watch . Previously the dotnet watch command simply restarted...
Read more >
Getting started with Minimal web API using ASP.NET Core ...
Setting the port configuration from the command line argument --urls while running the app. We will see each of the approaches and learn...
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