SignalR on Core 2.2 fails when deploying to Azure

Viewed 89

I have set up a plain SignalR solution using .NET Core 2.2. I cannot use Core 3.x because I need to use some libraries that depends on 2.2.

It works fine when i debug locally.

However, when I deploy to Azure as an App Service, whenever the JS tries to establish a connection, I can see in Chrome's network tab that it fails when calling /hub/negotiate, and that it returns a 400.

This does not happen locally. Locally I'm running IIS Express, and the server in Azure is running Kestrel.

What I have tried thus far:

  • Made sure web sockets is enabled under configuration in Azure. It was already enabled.
  • I believe Kestrel is behind a proxy in Azure, so I added app.UseForwardedHeaders(new ForwardedHeadersOptions { ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto }); at the very top. This had no effect.

I'm not using MessagePack.

Using:

  • netcoreapp2.2
  • @aspnet/signalr 1.1.4 (is this correct for 2.2? it works locally)

What could be wrong?

1 Answers

I can tell you clearly that there is no problem using signalr 1.1.4 in .net core 2.2.

It can run normally when deployed in windows and linux. You can download my test code from github, and compare with your project, is there any modification that caused this error?

The proxy settings are not used.

The only thing to note is:

I found that when the project is deployed under linux, it takes a while to start normal operation, about three to five minutes. The reason is currently unclear. If you encounter it, you can raise a support ticket on the portal.

enter image description here

enter image description here

enter image description here

Related