簡體   English   中英

SignalR 值不能為 null。(參數“用戶名”)

[英]SignalR Value cannot be null. (Parameter 'userName')

我在node.js 代理后面使用 SignalR,但出現此錯誤:

{"error":"An unexpected error occurred during connection handshake. AggregateException: One or more errors occurred. (Value cannot be null. (Parameter 'userName'))"}

SignalR 是否因為我已經添加了[AllowAnonymous]或代理服務器導致消息格式錯誤而嘗試驗證連接,因為我使用 JSON 傳輸格式來確保消息可讀以便我可以查看是否有任何問題。

在此處輸入圖像描述

Firefox 日志: 在此處輸入圖像描述

后端

        services.AddSignalR(config =>
        {
            config.MaximumReceiveMessageSize = 10 * 1024 * 1024; // 10 mega-bytes
            config.StreamBufferCapacity = 50;
            config.EnableDetailedErrors = true;
        }).AddNewtonsoftJsonProtocol();

React-Native SignalR

const signalR = new signalRBuilder.HubConnectionBuilder()
  .withUrl(prefixUrl('/log'))
  .configureLogging(LogLevel.Trace)
  .withAutomaticReconnect()
  .withHubProtocol(new JsonHubProtocol())
  .build();

signalR.start();

React-native 項目:

.NET web 申請

使用應用程序重定向時,您可能會丟失 header 信息,這可能會導致 signalR 中出現一些錯誤

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM