Skip to content

The browser is stuck with error "WebSocket connection to 'wss://localhost:65041/' failed:" after dotnet watch for Blazor Web App ~ Server ~Global #52293

@Susie-1989

Description

@Susie-1989

REGRESSION INFO: Repro on 9.0.308

INSTALL STEPS

  1. OS: window x64
  2. Install the SDK 10.0.101

REPRO STEPS

  1. Open up a normal Command Prompt (Terminal)
  2. Create Blazor Web App ~ Server ~Global
  dotnet new blazor -ai true -o blazor11
  cd blazor11
  dotnet watch
  1. Open Home.razor and modify the code and save this file.

Note:

  1. After refresh the browser, it will work.
  2. This issue works well for Blazor Web App ~ Server ~ Per page/component
  3. This issue works well for mvc /razor project
  4. There is a similar issue 64051

    ACTUAL The browser is stuck and no response when clicking any button.
Image
PageLogger::scheduleLogFlush - scheduling timer
mmr_main.js:1  17:43:29.431 MMRWarn: MMR readInjectionParameters: input parameter element missing.
Warn @ mmr_main.js:1
blazor.web.wmp8iwak4q.js:1 [2025-12-29T09:43:29.476Z] Information: Normalizing '_blazor' to 'http://localhost:5234/_blazor'.
blazor.web.wmp8iwak4q.js:1 [2025-12-29T09:43:29.502Z] Information: WebSocket connected to ws://localhost:5234/_blazor?id=dv1HiKt2_WcdqEM7vhGkIQ.
aspnetcore-browser-refresh.js:350  WebSocket connection to 'wss://localhost:65041/' failed: 
(anonymous) @ aspnetcore-browser-refresh.js:350
[NEW] Explain Console errors by using Copilot in Edge: click
C:\Users\v-yuwzh\blazor11>dotnet watch --verbose
dotnet watch ⌚ Working directory: 'C:\Users\v-yuwzh\blazor11'
dotnet watch ⌚ Watching with Hot Reload.
dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload.
dotnet watch 💡 Press Ctrl+R to restart.
dotnet watch 🔨 Building C:\Users\v-yuwzh\blazor11\blazor11.csproj ...
dotnet watch 🚀 Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'build C:\Users\v-yuwzh\blazor11\blazor11.csproj -consoleLoggerParameters:NoSummary;Verbosity=minimal --property:NuGetInteractive=true': process id 24796
dotnet watch ⌚ Process id 24796 ran for 6237ms and exited with exit code 0.
dotnet watch 🔨 Build succeeded: C:\Users\v-yuwzh\blazor11\blazor11.csproj
dotnet watch 🔨   Determining projects to restore...
dotnet watch 🔨   All projects are up-to-date for restore.
dotnet watch 🔨   blazor11 -> C:\Users\v-yuwzh\blazor11\bin\Debug\net10.0\blazor11.dll
dotnet watch 🔨
dotnet watch 🔨 Build succeeded.
dotnet watch 🔨     0 Warning(s)
dotnet watch 🔨     0 Error(s)
dotnet watch 🔨
dotnet watch 🔨 Time Elapsed 00:00:05.93
dotnet watch ⌚ Watching 66 file(s) for changes
dotnet watch ⌚ Exclusion glob: '**\node_modules\**;node_modules\**;**\jspm_packages\**;jspm_packages\**;**\bower_components\**;bower_components\**;**\packages.lock.json;bin\Debug\/**;obj\Debug\/**;bin\/**;obj\/**;**/*.user;**/*.*proj;**/*.sln;**/*.slnx;**/*.vssscc;**/.DS_Store' under project 'C:\Users\v-yuwzh\blazor11'
dotnet watch ⌚ Application kind: WebApplication.
dotnet watch 🔃 [blazor11 (net10.0)] Using browser-refresh middleware
dotnet watch 🔃 [blazor11 (net10.0)] Refresh server running at wss://localhost:65041,ws://localhost:65042.
dotnet watch ⌚ dotnet-watch is configured to launch a browser on ASP.NET Core application startup.
dotnet watch 🔥 [blazor11 (net10.0)] Waiting for application to connect to pipe a74f49db9b564dc3925d67c9b4d5a713.
dotnet watch 🚀 [blazor11 (net10.0)] Launched 'C:\Program Files\dotnet\dotnet.exe' with arguments 'run --no-build -e DOTNET_WATCH=1 -e DOTNET_WATCH_ITERATION=1 -e "HOTRELOAD_DELTA_CLIENT_LOG_MESSAGES=dotnet watch 🕵️ [blazor11 (net10.0)]" -e DOTNET_MODIFIABLE_ASSEMBLIES=debug -e "DOTNET_STARTUP_HOOKS=C:\Program Files\dotnet\sdk\10.0.101\DotnetTools\dotnet-watch\10.0.101\tools\net10.0\any\hotreload\net6.0\Microsoft.AspNetCore.Watch.BrowserRefresh.dll;C:\Program Files\dotnet\sdk\10.0.101\DotnetTools\dotnet-watch\10.0.101\tools\net10.0\any\hotreload\net10.0\Microsoft.Extensions.DotNetDeltaApplier.dll" -e DOTNET_WATCH_HOTRELOAD_NAMEDPIPE_NAME=a74f49db9b564dc3925d67c9b4d5a713 -e ASPNETCORE_AUTO_RELOAD_WS_ENDPOINT=wss://localhost:65041,ws://localhost:65042 -e ASPNETCORE_AUTO_RELOAD_WS_KEY=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv72iPwmaQQscm3trK+9CKujoBB5Ul+nJr52ot2eyRW772SdFDqp5m8AKKFtHpa3POTFEbBW6PN/wHiLMI30oclSa/bWQil3dkW9fOBNF65m6pSS0wsCTjf/G7cKeELl4ZvsNq29Kbm5NTJRv2F5M9oo8FOCW/D/VcJLgupMXIlUBZLYCLEXqy160YAvc8jxPGqBh7MS/SAIBiMiVi6N+fM3mV3tQ1J4ED/xO9I8PDbAvGT1NbZGjt7YmXWHNXFex1vnB3U5N/7849dE5/a9EBEPNnhw3MeECqzkQ0K4Kn21CQK0HtUlp5q6jub2jReLk6c0rCgF0UnnsLT93aRNdUQIDAQAB -e ASPNETCORE_AUTO_RELOAD_VDIR=/ -e ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.AspNetCore.Watch.BrowserRefresh -e Logging__LogLevel__Microsoft.AspNetCore.Watch=Debug': process id 12672
Using launch settings from C:\Users\v-yuwzh\blazor11\Properties\launchSettings.json...
dotnet watch 🕵️ [blazor11 (net10.0)] Loaded into process: C:\Users\v-yuwzh\blazor11\bin\Debug\net10.0\blazor11.dll (C:\Program Files\dotnet\sdk\10.0.101\DotnetTools\dotnet-watch\10.0.101\tools\net10.0\any\hotreload\net10.0\Microsoft.Extensions.DotNetDeltaApplier.dll)
dotnet watch 🕵️ [blazor11 (net10.0)] Windows Ctrl+C handling enabled.
dotnet watch 🕵️ [blazor11 (net10.0)] Connecting to hot-reload server via pipe a74f49db9b564dc3925d67c9b4d5a713
dotnet watch 🕵️ [blazor11 (net10.0)] Connected.
dotnet watch 🔥 [blazor11 (net10.0)] Capabilities: 'Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType AddFieldRva'.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BlazorWasmHotReloadMiddleware[0]
      Middleware loaded
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/aspnetcore-browser-refresh.js (16481 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Middleware loaded. Script /_framework/blazor-hotreload.js (799 B).
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[0]
      Middleware loaded: DOTNET_MODIFIABLE_ASSEMBLIES=debug, __ASPNETCORE_BROWSER_TOOLS=true
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5234
dotnet watch ⌚ Launching browser: http://localhost:5234
dotnet watch 🚀 Launched 'http://localhost:5234' with arguments '': process id 12000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: C:\Users\v-yuwzh\blazor11
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
      Failed to determine the https port for redirect.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[1]
      Response markup is scheduled to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[2]
      Response markup was updated to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserScriptMiddleware[0]
      Script injected: /_framework/aspnetcore-browser-refresh.js
dotnet watch 🔥 Hot reload session started.
dotnet watch ⌚ Waiting for changes
dotnet watch 🌐 [Browser #1] Connected to refresh server.
dotnet watch ⌚ [FW] Updated 'C:\Users\v-yuwzh\blazor11\Components\Pages\Home.razor'.
dotnet watch ⌚ File change: Update 'C:\Users\v-yuwzh\blazor11\Components\Pages\Home.razor'.
dotnet watch ⌚ [FW] Updated 'C:\Users\v-yuwzh\blazor11\Components\Pages\Home.razor'.
dotnet watch ⌚ File change: Update 'C:\Users\v-yuwzh\blazor11\Components\Pages\Home.razor'.
dotnet watch ⌚ File updated: .\Components\Pages\Home.razor
dotnet watch 🔥 Hot reload capabilities: AddFieldRva AddInstanceFieldToExistingType AddMethodToExistingType AddStaticFieldToExistingType Baseline ChangeCustomAttributes GenericAddFieldToExistingType GenericAddMethodToExistingType GenericUpdateMethod NewTypeDefinition UpdateParameters.
dotnet watch 🔃 [blazor11 (net10.0)] Updating diagnostics.
dotnet watch 🔥 [blazor11 (net10.0)] Sending update batch #0
dotnet watch 🕵️ [blazor11 (net10.0)] Writing capabilities: Baseline AddMethodToExistingType AddStaticFieldToExistingType AddInstanceFieldToExistingType NewTypeDefinition ChangeCustomAttributes UpdateParameters GenericUpdateMethod GenericAddMethodToExistingType GenericAddFieldToExistingType AddFieldRva
dotnet watch 🕵️ [blazor11 (net10.0)] Applying updates to module f1256bf9-a423-4120-970d-7808bc2c0598.
dotnet watch 🕵️ [blazor11 (net10.0)] Invoking metadata update handlers.
dotnet watch 🕵️ [blazor11 (net10.0)] System.Reflection.Metadata.RuntimeTypeMetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.Extensions.DependencyInjection.ActivatorUtilities+ActivatorUtilitiesUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] System.Text.Json.JsonSerializerOptionsUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] System.ComponentModel.ReflectionCachesUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Routing.RouteValueDictionary+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.JSInterop.Infrastructure.DotNetDispatcher+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.Routing.RazorComponentsEndpointHttpContextExtensions+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.Endpoints.HotReloadService.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.Extensions.Internal.PropertyHelper+MetadataUpdateHandler.ClearCache
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.HotReload.HotReloadManager.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.HotReload.HotReloadManager.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.Endpoints.HotReloadService.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.Endpoints.EndpointComponentState.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.HotReload.HotReloadManager.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Microsoft.AspNetCore.Components.HotReload.HotReloadManager.UpdateApplication
dotnet watch 🕵️ [blazor11 (net10.0)] Updates applied.
dotnet watch 🔥 [blazor11 (net10.0)] Update batch #0 completed.
dotnet watch 🔥 [blazor11 (net10.0)] Updates applied: 1 out of 1.
dotnet watch 🔥 [blazor11 (net10.0)] Hot reload succeeded.
dotnet watch 🔃 [blazor11 (net10.0)] Refreshing browser.
dotnet watch 🔥 Hot reload change handled in 2557ms.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[1]
      Response markup is scheduled to include browser refresh script injection.
dbug: Microsoft.AspNetCore.Watch.BrowserRefresh.BrowserRefreshMiddleware[2]
      Response markup was updated to include browser refresh script injection.

EXPECTED
The browser is not stuck, the page is displayed normally.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions