[hot-refresh] WebSocket connection to 'ws://localhost:50417/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### Describe the bug
During remote access, the browser reports the following error:
```
WebSocket connection to 'ws://localhost:50417/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
```
After investigating, we discovered that in **aspnetcore-browser-refresh.js** the host is hard-coded to **localhost**, so it never attempts to connect back to the remote machine.
```js
const webSocketUrls = 'wss://localhost:50416,ws://localhost:50417'.split(',');
```
### Expected Behavior
_No response_
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
_No response_
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.