SignalR无法在aspnetcore 2.1中启动连接

时间:2018-04-03 17:46:41

标签: connection signalr-hub asp.net-core-signalr

我正在尝试按照本教程https://blogs.msdn.microsoft.com/webdev/2018/02/27/asp-net-core-2-1-0-preview1-getting-started-with-signalr/进行SignalR。安装了适当版本的signaR 2.1以及Visual Studio Preview。我的程序似乎编译正常,但是当我加载聊天页面时,启动连接失败。使用Chrome。

控制台日志显示以下错误:

Information: Normalizing '/hubs/chat' to 'https://localhost:44380/hubs/chat'
signalr.js:1337 

POST https://localhost:44380/hubs/chat/negotiate 500 ()
(anonymous) @ signalr.js:1337
DefaultHttpClient.send @ signalr.js:1302
HttpClient.post @ signalr.js:1291
(anonymous) @ signalr.js:1870
step @ signalr.js:1816
(anonymous) @ signalr.js:1797
(anonymous) @ signalr.js:1791
__awaiter @ signalr.js:1787
HttpConnection.startInternal @ signalr.js:1851
(anonymous) @ signalr.js:1845
step @ signalr.js:1816
(anonymous) @ signalr.js:1797
(anonymous) @ signalr.js:1791
__awaiter @ signalr.js:1787
HttpConnection.start @ signalr.js:1839
(anonymous) @ signalr.js:2347
step @ signalr.js:2232
(anonymous) @ signalr.js:2213
(anonymous) @ signalr.js:2207
__awaiter @ signalr.js:2203
HubConnection.start @ signalr.js:2338
(anonymous) @ chat:44
signalr.js:1744 

Error: Failed to start the connection. Error
ConsoleLogger.log @ signalr.js:1744
(anonymous) @ signalr.js:1903
step @ signalr.js:1816
(anonymous) @ signalr.js:1797
rejected @ signalr.js:1789
Promise.then (async)
step @ signalr.js:1790
(anonymous) @ signalr.js:1791
__awaiter @ signalr.js:1787
HttpConnection.startInternal @ signalr.js:1851
(anonymous) @ signalr.js:1845
step @ signalr.js:1816
(anonymous) @ signalr.js:1797
(anonymous) @ signalr.js:1791
__awaiter @ signalr.js:1787
HttpConnection.start @ signalr.js:1839
(anonymous) @ signalr.js:2347
step @ signalr.js:2232
(anonymous) @ signalr.js:2213
(anonymous) @ signalr.js:2207
__awaiter @ signalr.js:2203
HubConnection.start @ signalr.js:2338
(anonymous) @ chat:44
signalr.js:1231 

Uncaught (in promise) Error
    at new HttpError (signalr.js:1231)
    at XMLHttpRequest.xhr.onload (signalr.js:1328)

0 个答案:

没有答案