Add separate WS and WSS ports for browser refresh server to fix TLS port conflict#52959
Draft
Add separate WS and WSS ports for browser refresh server to fix TLS port conflict#52959
Conversation
When DOTNET_WATCH_AUTO_RELOAD_WS_PORT is set and TLS dev certificates are available, BrowserRefreshServer was trying to bind both HTTP and HTTPS to the same port, which causes an "address already in use" error. Fixed by only binding HTTPS when TLS is supported, instead of both HTTP and HTTPS to the same port. This is the correct behavior since you cannot bind both protocols to the same TCP port. Co-authored-by: dbreshears <3432571+dbreshears@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix dotnet watch failing with auto reload port set
Fix BrowserRefreshServer port conflict when DOTNET_WATCH_AUTO_RELOAD_WS_PORT is set with TLS
Feb 10, 2026
3 tasks
Member
|
@copilot, please revert the last change, what is needed is 2 Environment variables. DOTNET_WATCH_AUTO_RELOAD_WS_PORT and a new one DOTNET_WATCH_AUTO_RELOAD_WSS_PORT with variables for AutoReloadWSPort and AutoReloadWSSPort. Then in FromEnvironment we need AutoReloadWebSocketSecurePort set to AutoReloadWSSPort |
- Added DOTNET_WATCH_AUTO_RELOAD_WSS_PORT environment variable - Added AutoReloadWebSocketSecurePort property to EnvironmentOptions - Updated BrowserRefreshServer to use separate ports for HTTP and HTTPS - This allows users to avoid port conflicts when TLS is supported When TLS is available, users can now set: - DOTNET_WATCH_AUTO_RELOAD_WS_PORT for HTTP (e.g., 8081) - DOTNET_WATCH_AUTO_RELOAD_WSS_PORT for HTTPS (e.g., 8082) Co-authored-by: dbreshears <3432571+dbreshears@users.noreply.github.com>
Contributor
Author
Done! I've implemented the two environment variables approach:
Users can now set: export DOTNET_WATCH_AUTO_RELOAD_WS_PORT=8081
export DOTNET_WATCH_AUTO_RELOAD_WSS_PORT=8082
dotnet watchTested and verified both ports are used correctly. Commit: 813585f |
Copilot
AI
changed the title
Fix BrowserRefreshServer port conflict when DOTNET_WATCH_AUTO_RELOAD_WS_PORT is set with TLS
Add separate WS and WSS ports for browser refresh server to fix TLS port conflict
Feb 12, 2026
tmat
approved these changes
Feb 13, 2026
tmat
reviewed
Feb 13, 2026
Renamed properties and variables as requested: - AutoReloadWebSocketHostName → BrowserWebSocketHostName - AutoReloadWebSocketPort → BrowserWebSocketPort - AutoReloadWebSocketSecurePort → BrowserWebSocketSecurePort Updated in: - EnvironmentOptions.cs (property definitions and FromEnvironment) - BrowserRefreshServer.cs (constructor parameters and local variables) - WebApplicationAppModel.cs (property usage) Co-authored-by: tmat <41759+tmat@users.noreply.github.com>
This was referenced Feb 13, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix dotnet watch port binding when DOTNET_WATCH_AUTO_RELOAD_WS_PORT is set with TLS
Changes:
DOTNET_WATCH_AUTO_RELOAD_WSS_PORTBrowserWebSocketSecurePortproperty to EnvironmentOptionsOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.