Search code examples
.netdockerkubernetessignalr

SignalR (on docker container) Bad Gateway after upgrading to .NET8


So we just upgraded our .NET 6 project to .NET 8 and everything works great, except for the SignalR connection.

We run on a kubernetes cluster and have an ingress and service (which did not change) to connect to the docker container which is running the .NET application.

When we run the .NET 6 container everything works perfect, but as soon as we deploy the .NET 8 container the HubConnection.StartAsync (from other application) throws:

'Response status code does not indicate success: 502 (Bad Gateway).'

Does anybody know if something changed in .NET 8 or the docker container (mcr.microsoft.com/dotnet/aspnet:8.0) compared to .NET 6 which makes it not expose the port or something else that would block the communication?

We have tried running it on localhost and then it can connect. Also the .NET 6 application can still run fine, so that makes me believe it is not the kubernetes ingress or service, but something in the container.

Dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base

FROM base AS final
WORKDIR /app
COPY .  .

ENV TZ="Europe/Amsterdam"

EXPOSE 80

ENTRYPOINT ["dotnet", "application.dll"]

Solution

  • Microsoft updated the Dotnet 8 images to use port 8080 and 8081 by default

    There's an excellent post on Andrew Lock's blog about it: https://andrewlock.net/exploring-the-dotnet-8-preview-updates-to-docker-images-in-dotnet-8/

    I had similar issues in a similar situation when we started our migration around RC1 time. After updating the relevant service to forward to port 8080/81, everything came back to life.

    However, I think a similar issue may have returned in the GA release (I found your question by searching for an answer to mine!)