Open Closed

SigalR 502 #5668


User avatar
0
DominaTang created
  • ABP Framework version: v7.2.1 - Micro Service
  • UI Type: Angular
  • Database System: MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes

Do you have a sample code for SignalR send message to Angular app. Angular get 502 for negociate.

In Micro Service Application module: typeof(AbpAutoMapperModule),

Configure<AbpSignalROptions>(options =>
{
    options.Hubs.AddOrUpdate(
        typeof(NotificationHub), //Hub type
        config => //Additional configuration
        {
            config.ConfigureActions.Add(hubOptions =>
            {
                //Additional options
                hubOptions.LongPolling.PollTimeout = TimeSpan.FromSeconds(30);
            });
        }
    );
});

In Gateway module:

app.UseWebSockets();
        app.UseOcelot().Wait();
        app.UseRouting()

{
      "ServiceKey": "SignalR Service",
      "DownstreamPathTemplate": "/signalr-hubs/{evertything}",
      "DownstreamScheme": "http",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 45186
        }
      ],
      "UpstreamHttpMethod": [ "POST" ],
      "UpstreamPathTemplate": "/signalr-hubs/{evertything}",
      "ReRouteIsCaseSensitive": false
    },
    {
      "ServiceKey": "SignalR Service",
      "DownstreamPathTemplate": "/signalr-hubs/{everything}",
      "ReRouteIsCaseSensitive": false,
      "DownstreamScheme": "ws",
      "DownstreamHostAndPorts": [
        {
          "Host": "localhost",
          "Port": 45186
        }
      ],
      "UpstreamPathTemplate": "/signalr-hubs/{anyHub}",
      "UpstreamHttpMethod": [ "GET", "POST", "PUT", "DELETE", "OPTIONS" ]
    },

3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Could you share the error log? thanks.

  • User Avatar
    0
    DominaTang created

    From Angular App, console: POST https://localhost:44325/signalr-hubs/messaginghub/negotiate?negotiateVersion=1 502

    From Gateway log: web-gateway_4420d4f8-1]: [13:53:47 DBG] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: Downstream url is http://localhost:45186/signalr-hubs/messaginghub/negotiate?negotiateVersion=1 [web-gateway_4420d4f8-1]: [13:53:47 DBG] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: IHttpRequester returned an error, setting pipeline error [web-gateway_4420d4f8-1]: [13:53:47 WRN] requestId: 0HMT7TSEGNSB6:0000000D, previousRequestId: no previous request id, message: Error Code: ConnectionToDownstreamServiceError Message: Error connecting to downstream service, exception: System.Net.Http.HttpRequestException: An error occurred while sending the request. [web-gateway_4420d4f8-1]: ---> System.IO.IOException: The response ended prematurely.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    System.Net.Http.HttpRequestException: An error occurred while sending the request. [web-gateway_4420d4f8-1]: ---> System.IO.IOException: The response ended prematurely.

    Could you share the full logs? (web gateway& signalr service)

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11