Activities of "malvarado"

Hi,

I made some more tests, and I found out that if I run the WebGateway with IIS Express from Visual Studio, Signalr works fine.

I only get the errors when I run the csproj direclty, either from Visual Studio or with Tye.

Why could this be? Is there a way to configure the csproj, Program.cs, or tye so it has the same behavior as when running it with IIS?

Thanks.

Hello,

We are still experiencing the same errors.

Could this be an issue related to some configuration on our machines related to WebSockets? Or maybe the Locale/Region the frontend and backend are configured? (maybe the Signalr library expects or uses english, and the locales in our machines are in spanish)

Thanks!

Hi,

Can you upload the full solution to the same Google Drive I uploaded it?

I implemented the fixes and I'm still getting the same errors:

  • Handshakes work fine
  • Requests returns 200 code, but I'm still getting the errors:
    • On frontend: WebSocket connection to 'wss://localhost:44325/signalr-hubs/demo?id=G-hyAmzj1-GUAN6EYnrTyw' failed: Unrecognized frame opcode: 6 WebSocket closed with status code: 1006 (no reason given).
    • On WebGateway log:
requestId: 0HN28RBEI53CU:00000003, previousRequestId: no previous request id, message: Exception caught in global error handler, exception message: The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseReceived', exception stack:    at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)

Thanks!

Hi,

I just sent you an example project via email. Please, let me know if you need anything else to test the problem.

Thanks!

I'm still getting errors with signalr. I tried updating the Ocelot config as you mentioned and it still doesn't work.

I tried different configurations and it throws different errors. With this current configuration, both handshakes return 200 codes. Then the WS request returns a 200 code but appears to throw and "Unrecognized frame upcode: 6" error, and we get a new Exception on the WebGateway log:

Current WebGateway config:

{
  "DownstreamPathTemplate": "/signalr-hubs/{everything}",
  "DownstreamScheme": "wss",
  "DownstreamHostAndPorts": [
	{
	  "Host": "localhost",
	  "Port": 44878
	}
  ],
  "UpstreamPathTemplate": "/signalr-hubs/{everything}"
},
{
  "DownstreamPathTemplate": "/ws",
  "UpstreamPathTemplate": "/",
  "DownstreamScheme": "wss",
  "DownstreamHostAndPorts": [
	{
	  "Host": "localhost",
	  "Port": 44878
	}
  ]
}

WebGateway logs:

2024-03-14 13:34:20.456 -03:00 [INF] Request starting HTTP/2 OPTIONS https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - -
2024-03-14 13:34:20.457 -03:00 [INF] CORS policy execution successful.
2024-03-14 13:34:20.457 -03:00 [INF] Request finished HTTP/2 OPTIONS https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - - - 204 - - 0.4313ms
2024-03-14 13:34:20.470 -03:00 [INF] Request starting HTTP/2 POST https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0
2024-03-14 13:34:20.471 -03:00 [INF] CORS policy execution successful.
2024-03-14 13:34:20.471 -03:00 [INF] requestId: 0HN248IBU7TIA:00000001, previousRequestId: no previous request id, message: EndpointRateLimiting is not enabled for /signalr-hubs/{everything}
2024-03-14 13:34:20.471 -03:00 [INF] requestId: 0HN248IBU7TIA:00000001, previousRequestId: no previous request id, message: No authentication needed for /signalr-hubs/demo/negotiate
2024-03-14 13:34:20.471 -03:00 [INF] requestId: 0HN248IBU7TIA:00000001, previousRequestId: no previous request id, message: /signalr-hubs/{everything} route does not require user to be authorized
2024-03-14 13:34:20.485 -03:00 [INF] requestId: 0HN248IBU7TIA:00000001, previousRequestId: no previous request id, message: 200 (OK) status code, request uri: wss://localhost:44878/signalr-hubs/demo/negotiate?negotiateVersion=1
2024-03-14 13:34:20.485 -03:00 [INF] Request finished HTTP/2 POST https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0 - 200 316 application/json 14.7364ms
2024-03-14 13:34:20.497 -03:00 [INF] Request starting HTTP/2 CONNECT https://localhost:44325/signalr-hubs/demo?id=O_QfCDfM1fl8YqKTWpheSg&access_token=eyJh...asd - -
2024-03-14 13:34:20.497 -03:00 [INF] CORS policy execution successful.
2024-03-14 13:34:20.524 -03:00 [ERR] requestId: 0HN248IBU7TIA:00000003, previousRequestId: no previous request id, message: Exception caught in global error handler, exception message: The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseReceived', exception stack:    at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
   at System.Net.WebSockets.ManagedWebSocket.CloseOutputAsyncCore(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.PumpWebSocket(WebSocket source, WebSocket destination, Int32 bufferSize, CancellationToken cancellationToken)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Proxy(HttpContext context, String serverEndpoint)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.DownstreamUrlCreator.Middleware.DownstreamUrlCreatorMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.LoadBalancer.Middleware.LoadBalancingMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Request.Middleware.DownstreamRequestInitialiserMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Multiplexer.MultiplexingMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.DownstreamRouteFinder.Middleware.DownstreamRouteFinderMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Errors.Middleware.ExceptionHandlerMiddleware.Invoke(HttpContext httpContext) RequestId: 0HN248IBU7TIA:00000003
System.Net.WebSockets.WebSocketException (0x80004005): The WebSocket is in an invalid state ('Aborted') for this operation. Valid states are: 'Open, CloseReceived'
   at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState(WebSocketState currentState, Boolean isDisposed, WebSocketState[] validStates)
   at System.Net.WebSockets.ManagedWebSocket.CloseOutputAsyncCore(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.PumpWebSocket(WebSocket source, WebSocket destination, Int32 bufferSize, CancellationToken cancellationToken)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Proxy(HttpContext context, String serverEndpoint)
   at Ocelot.WebSockets.Middleware.WebSocketsProxyMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.DownstreamUrlCreator.Middleware.DownstreamUrlCreatorMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.LoadBalancer.Middleware.LoadBalancingMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Request.Middleware.DownstreamRequestInitialiserMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Multiplexer.MultiplexingMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.DownstreamRouteFinder.Middleware.DownstreamRouteFinderMiddleware.Invoke(HttpContext httpContext)
   at Ocelot.Errors.Middleware.ExceptionHandlerMiddleware.Invoke(HttpContext httpContext)
2024-03-14 13:34:20.525 -03:00 [INF] Request finished HTTP/2 CONNECT https://localhost:44325/signalr-hubs/demo?id=O_QfCDfM1fl8YqKTWpheSg&access_token=eyJh...asd - - - 200 - - 28.1154ms

The WS request returns a 200 code, but in the messages tab it shows an error:

Hello liangshiwei,

I just tried that. Now I'm not getting the TimeOut error, but it seems it's still not connecting correctly. These are the logs:

WebGateway (You can see a UnableToFindDownstreamRouteError error):

2024-03-13 08:57:47.440 -03:00 [INF] Request starting HTTP/2 OPTIONS https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - -
2024-03-13 08:57:47.440 -03:00 [INF] CORS policy execution successful.
2024-03-13 08:57:47.440 -03:00 [INF] Request finished HTTP/2 OPTIONS https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - - - 204 - - 0.2458ms
2024-03-13 08:57:47.451 -03:00 [INF] Request starting HTTP/2 POST https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0
2024-03-13 08:57:47.451 -03:00 [INF] CORS policy execution successful.
2024-03-13 08:57:47.452 -03:00 [INF] requestId: 0HN22O3N3S1OQ:00000001, previousRequestId: no previous request id, message: EndpointRateLimiting is not enabled for /signalr-hubs/{everything}
2024-03-13 08:57:47.452 -03:00 [INF] requestId: 0HN22O3N3S1OQ:00000001, previousRequestId: no previous request id, message: No authentication needed for /signalr-hubs/demo/negotiate
2024-03-13 08:57:47.452 -03:00 [INF] requestId: 0HN22O3N3S1OQ:00000001, previousRequestId: no previous request id, message: /signalr-hubs/{everything} route does not require user to be authorized
2024-03-13 08:57:47.465 -03:00 [INF] requestId: 0HN22O3N3S1OQ:00000001, previousRequestId: no previous request id, message: 200 (OK) status code, request uri: https://localhost:44878/signalr-hubs/demo/negotiate?negotiateVersion=1
2024-03-13 08:57:47.466 -03:00 [INF] Request finished HTTP/2 POST https://localhost:44325/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0 - 200 316 application/json 14.6363ms
2024-03-13 08:57:47.478 -03:00 [INF] Request starting HTTP/2 CONNECT https://localhost:44325/signalr-hubs/demo?id=-BoVMzEFfiK1Z_aHpGzQGw&access_token=eyJh...asd - -
2024-03-13 08:57:47.478 -03:00 [INF] CORS policy execution successful.
2024-03-13 08:57:47.478 -03:00 [WRN] requestId: 0HN22O3N3S1OQ:00000003, previousRequestId: no previous request id, message: DownstreamRouteFinderMiddleware setting pipeline errors. IDownstreamRouteFinder returned Error Code: UnableToFindDownstreamRouteError Message: Failed to match Route configuration for upstream path: /signalr-hubs/demo, verb: CONNECT.
2024-03-13 08:57:47.478 -03:00 [INF] Request finished HTTP/2 CONNECT https://localhost:44325/signalr-hubs/demo?id=-BoVMzEFfiK1Z_aHpGzQGw&access_token=eyJh...asd - - - 200 - - 0.5002ms
2024-03-13 08:57:47.478 -03:00 [INF] Connection id "0HN22O3N3S1OQ", Request id "0HN22O3N3S1OQ:00000003": the application completed without reading the entire request body.

OperacionesService:

2024-03-13 08:57:47.462 -03:00 [INF] Request starting HTTP/1.1 POST https://localhost:44878/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0
2024-03-13 08:57:47.464 -03:00 [INF] Executing endpoint '/signalr-hubs/demo/negotiate'
2024-03-13 08:57:47.465 -03:00 [INF] Executed endpoint '/signalr-hubs/demo/negotiate'
2024-03-13 08:57:47.465 -03:00 [INF] Request finished HTTP/1.1 POST https://localhost:44878/signalr-hubs/demo/negotiate?negotiateVersion=1 - 0 - 200 316 application/json 3.4574ms

The request appears to return a 200 code, but it still doesn't get to the hub methods:

Also when we try to send a message we still get the following error (we were getting the same error before the change you suggested also):

Zobrazeno od 1 do 6 z celkem 6 záznamů
Made with ❤️ on ABP v8.2.0-preview Updated on března 25, 2024, 15:11