dotnet / aspire-samples

MIT License
571 stars 158 forks source link

[WebToolsE2E][Aspire] When running OrleansVoting using http, and then clicking the endpoint of any project, an unhandled exception occurs on the page: "Failed to start the transport 'WebSockets'". #277

Open v-sherryfan opened 2 months ago

v-sherryfan commented 2 months ago

REGRESSION INFO: Also repro on main branch (Aspire 8.0 P7)

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU
  2. Install VS 17.10 GA FB [ Includes Aspire 8.0.0 and SDK 8.0.300 ]
  3. Apply NuGet darc-pub-dotnet-aspire Feed
  4. Install Docker Desktop for Windows
  5. Install azd [1.10.0-beta.1-daily.3787247]

REPRO STEPS

  1. Clone aspire-samples repo, checkout the release/8.0 branch
  2. Open samples\OrleansVoting.sln
  3. Build
  4. Running (F5 / Ctrl+F5) with http
  5. Click on endpoint of any peoject

ACTUAL

image

Workaround

NOTE

EXPECTED

image

davidfowl commented 2 months ago

Others have reported that websockets dont work as well.

Nicolas62x commented 4 days ago

I have the same issue, when my app tries to use websockets it crashes the webhost:

info: Aspire.Hosting.DistributedApplication[0]
      Login to the dashboard at https://localhost:17130/login?t=1219810f5d5e68bb166763b068b674a9
info: Aspire.Hosting.DistributedApplication[0]
      Distributed application started. Press Ctrl+C to shut down.

C:\Users\nicol\source\repos\MyApp\MyApp.AppHost\bin\Debug\net8.0\MyApp.AppHost.exe (processus 5872) s'est terminé avec le code -1 (0xffffffff).

Sometimes it works but the socket is disconnected in the middle:

image

System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseReceived, CloseSent'
   at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
   at System.Net.WebSockets.ManagedWebSocket.CloseAsync(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
--- End of stack trace from previous location ---
   at MyApp.API.FileUploadController.Get(HttpContext cont, CancellationToken cancellationToken) in C:\Users\nicol\source\repos\MyApp\MyApp.Web\API\FileUpload\FileUploadController.cs:line 156
   at Microsoft.AspNetCore.Http.RequestDelegateFactory.ExecuteTaskResult[T](Task`1 task, HttpContext httpContext)
   at Program.<>c__DisplayClass0_0.<<<Main>$>b__2>d.MoveNext() in C:\Users\nicol\source\repos\MyApp\MyApp.Web\Program.cs:line 167
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)

It works just fine when run the app without the apphost