2017-03-05 21 views
0

成功創建服務器signalR應用程序,並且我可以通過導航到http://localhost:11914/signalr/hubs來查看創建的JavaScript代碼模板。與System.Net.Http.WebRequestHandler類型相關的signalR中發生異常

客戶端應用程序是由Visual Studio 2017最新RC使用最近模板創建的.NET 4.6.2 web api。當我執行下面的代碼:

var hubConnection = new HubConnection("http://localhost:11914"); 
    var hubProxy = hubConnection.CreateHubProxy("cache"); 
    hubProxy.On<CachedObjectInfo>("sendUpdateNotification", cachedObject => RefreshMemory(cachedObject)); 
    await hubConnection.Start(); 

我收到下面的異常擊中await hubConnection.Start();

type: 'System.Net.Http.WebRequestHandler'. Derived types must either match the security accessibility of the base type or be less accessible.' 

客戶端應用程序singalR時利用Microsoft.AspNet.SignalR.Client版本2.2.1包。

我不知道爲什麼我應該收到這樣的例外,我找不到任何解決方案。什麼是根本原因以及如何緩解它?

回答

1

我相信這是System.Net.Http包版本的問題。更具體地說,如果您爲運行的項目安裝了v4.1.1 - v4.3.0,那麼當您以.NET 4.6.1或4.6.2爲目標時,您將遇到此問題。有關更多詳細信息,請參見this thread。爲了解決這個問題,他們發佈了一個新的軟件包System.Net.Http 4.3.1,該軟件包可以消除這個錯誤。

相關問題