SignalR和ASP.NET Core 之間的差異SignalR | .net core signalr
本文內容 ASP.NETCoreSignalR不相容ASP.NET的用戶端或伺服器SignalR。本文詳細說明ASP.NETCore中已移除或變更的功能SignalR。如何識別SignalR版本功能差異自動重新連接在ASP.NETSignalR:依預設,SignalR如果中斷連接,則會嘗試重新連線到伺服器。在ASP.NETCoreSignalR:HubConnectionconnection=newHubConnectionBuilder().WithUrl(newUri("http://127.0.0.1:5000/chathub")).WithAutomaticReconnect().Build();constconnection=newsignalR.HubConnectionBuilder().withUrl("/chathub").withAutomaticReconnect().buil...
本文內容ASP.NET Core SignalR不相容 ASP.NET 的用戶端或伺服器 SignalR 。 本文詳細說明 ASP.NET Core 中已移除或變更的功能 SignalR 。
如何識別 SignalR 版本 功能差異 自動重新連接在 ASP.NET SignalR :
依預設, SignalR 如果中斷連接,則會嘗試重新連線到伺服器。在 ASP.NET Core SignalR :
HubConnection connection = new HubConnectionBuilder() .WithUrl(new Uri("http://127.0.0.1:5000/chathub")) .WithAutomaticReconnect() .Build(); const connection = new signalR.HubConnectionBuilder() .withUrl("/chathub") .withAutomaticReconnect() .build();在 ASP.NET Core 3.0 之前, SignalR 不支援自動重新連接。 如果用戶端已中斷連線,則使用者必須明確地啟動新的連線,才能重新連接。 在 ASP.NET 中 SignalR , SignalR 如果中斷連接,則會嘗試重新連線到伺服器。
通訊協定支援ASP.NET Core SignalR支援 JSON,以及以MessagePack[1]為基礎的新二進位通訊協定。 此外,也可以建立自訂通訊協定。
傳輸ASP.NET Core 不支援永久框架傳輸 SignalR 。
伺服器上的差異ASP.NET Core SignalR 伺服器端程式庫包含在 Microsoft.AspNetCore.App[2]中,用於和 MVC 專案的 ASP.NET Core Web 應用程式 範本 Razor 。
ASP.NET Core SignalR是 ASP.NET Core 中介軟體。 您必須在中呼叫來設定它 AddSignalR[3] ...