79309030

Date: 2024-12-26 08:37:20
Score: 1
Natty:
Report link

Maybe my answer will help more than one, although it doesn't answer the original question, but shows how to solve the problem related to the question's title in a general way.

I had a react client who gave me exactly the same error

For my part I referred to this answer https://github.com/Azure/azure-signalr/issues/1905#issuecomment-2357619864 on github, by enabling EnableDetailErrors as follows

_ = services.AddSignalR(e =>
{
    e.EnableDetailedErrors = true;
    e.MaximumReceiveMessageSize = 102400000;
});

Activating this property gives details of the problem encountered at the front end. I was therefore able to see that my error was linked to my implementation of the service that acted as a Hub in the backend, as shown in the following

[2024-12-26T08:18:53.523Z] Information: Close message received from server.
---
[2024-12-26T08:18:53.524Z] Debug: Stopping HubConnection.
---
[2024-12-26T08:18:53.524Z] Debug: HttpConnection.stopConnection(undefined) called while in state Disconnecting.
---
[2024-12-26T08:18:53.524Z] Error: Connection disconnected with error 'Error: Server returned an error on close: Connection closed with an error. InvalidOperationException: Unable to resolve service for type 'AutoMapper.IMapper' while attempting to activate 'ChatService.Services.Hubs.ChatHub'.'.
---
[2024-12-26T08:18:53.524Z] Debug: HubConnection.connectionClosed(Error: Server returned an error on close: Connection closed with an error. InvalidOperationException: Unable to resolve service for type 'AutoMapper.IMapper' while attempting to activate 'ChatService.Services.Hubs.ChatHub'.) called while in state Disconnecting.
Reasons:
  • Blacklisted phrase (1): how to solve
  • Blacklisted phrase (0.5): exactly the same error
  • Long answer (-1):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: C.N.T.P