dotnet
protocol_error
ai_generated
true
Microsoft.AspNetCore.SignalR.HubException: Failed to negotiate with the server. The server returned an unsupported negotiate version.
ID: dotnet/signalr-negotiate-version
88%Fix Rate
84%Confidence
1Evidence
2023-09-05First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| .NET 6.0 | active | — | — | — |
| .NET 7.0 | active | — | — | — |
| .NET 8.0 | active | — | — | — |
| Microsoft.AspNetCore.SignalR.Client 6.0 | active | — | — | — |
| Microsoft.AspNetCore.SignalR.Client 7.0 | active | — | — | — |
| Microsoft.AspNetCore.SignalR.Client 8.0 | active | — | — | — |
Root Cause
SignalR client and server negotiate connection parameters; an unsupported negotiate version error occurs when the client uses an outdated or incompatible SignalR protocol version that the server does not recognize.
generic中文
SignalR 客户端和服务器协商连接参数;当客户端使用的 SignalR 协议版本过时或不兼容,服务器无法识别时,会出现不支持的协商版本错误。
Official Documentation
https://learn.microsoft.com/en-us/aspnet/core/signalr/troubleshootWorkarounds
-
90% success Ensure both client and server use the same major version of Microsoft.AspNetCore.SignalR (e.g., both 6.0.x or both 8.0.x). Check .csproj files and server packages.
Ensure both client and server use the same major version of Microsoft.AspNetCore.SignalR (e.g., both 6.0.x or both 8.0.x). Check .csproj files and server packages.
-
85% success If using a custom negotiation endpoint, update it to return the correct negotiate response with protocol version 1 or higher.
If using a custom negotiation endpoint, update it to return the correct negotiate response with protocol version 1 or higher.
-
88% success Downgrade the client package to match the server version: dotnet add package Microsoft.AspNetCore.SignalR.Client --version 6.0.25
Downgrade the client package to match the server version: dotnet add package Microsoft.AspNetCore.SignalR.Client --version 6.0.25
中文步骤
确保客户端和服务器使用相同主版本的 Microsoft.AspNetCore.SignalR(例如均为 6.0.x 或 8.0.x)。检查 .csproj 文件和服务器包。
如果使用自定义协商端点,更新它以返回包含协议版本 1 或更高版本的正确协商响应。
降级客户端包以匹配服务器版本:dotnet add package Microsoft.AspNetCore.SignalR.Client --version 6.0.25
Dead Ends
Common approaches that don't work:
-
Set HubConnectionBuilder to use raw WebSockets without negotiation
80% fail
Disabling negotiation may bypass version check but causes connection failures if the server requires negotiation for transports like Server-Sent Events.
-
Upgrade only the client-side SignalR package to the latest version
65% fail
If the server is an older version, the latest client may introduce a negotiate version the server doesn't support; both sides must be compatible.
-
Ignore the error and retry connection with exponential backoff
95% fail
Retrying does not fix the protocol version mismatch; the negotiate request will fail repeatedly.