我的SignalR上的SignalR工作正常,但是当我将项目移到我的笔记本电脑上并尝试运行它时,SignalR会在控制台中抛出以下错误。
Error: No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.
我尝试使用不同版本无效(2.2,2.1.2,2.0.3)。
我已经研究过这个错误,但是没有一个解决方案似乎与为什么错误只会发生在一台PC上有关。有什么想法吗?
以下是signalR的完整日志:
[11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Client subscribed to
hub 'tcardhub'.jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Negotiating with '/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22tcardhub%22%7D%5D'.
SignalRHubService.js:60 Error: No transport could be initialized successfully. Try specifying a different transport or none at all for auto initialization.
at Object.signalR._.error (http://localhost:29858/Scripts/jquery.signalR-2.1.2.js:178:21)
at signalR.fn.signalR.start.initialize (http://localhost:29858/Scripts/jquery.signalR-2.1.2.js:553:50)
at Object.signalR.fn.signalR.start.connection._.negotiateRequest.signalR.transports._logic.ajax.success (http://localhost:29858/Scripts/jquery.signalR-2.1.2.js:765:21)
at n.Callbacks.j (https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js:2:26911)
at Object.n.Callbacks.k.fireWith [as resolveWith] (https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js:2:27724)
at x (https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js:4:11065)
at XMLHttpRequest.n.ajaxTransport.k.cors.a.crossDomain.send.b (https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js:4:14577)Hub.errorHandler @ SignalRHubService.js:60(anonymous function) @ jquery.signalR-2.1.2.js:836n.event.dispatch @ jquery.min.js:3n.event.add.r.handle @ jquery.min.js:3n.event.trigger @ jquery.min.js:3e.event.trigger @ jquery-migrate.min.js:2n.fn.extend.triggerHandler @ jquery.min.js:3signalR.fn.signalR.start.initialize @ jquery.signalR-2.1.2.js:558signalR.fn.signalR.start.connection._.negotiateRequest.signalR.transports._logic.ajax.success @ jquery.signalR-2.1.2.js:765n.Callbacks.j @ jquery.min.js:2n.Callbacks.k.fireWith @ jquery.min.js:2x @ jquery.min.js:4n.ajaxTransport.k.cors.a.crossDomain.send.b @ jquery.min.js:4
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Stopping connection.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Client subscribed to hub 'tcardhub'.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Negotiating with '/signalr/negotiate?clientProtocol=1.4&connectionToken=U6E4eibrnyXgS%2FJWuNo5iwIy%2BU8S6x1w9Vh%2FDmthMMvFCw8g%2BX53Fq9f%2FlNdqyJIOW0j7uk8sZ4BwN4uP52QwpFNMjZJDUdZ2ZjeXLgSvSLUZmQ3L9fZLXYatHcs0bh2&connectionData=%5B%7B%22name%22%3A%22tcardhub%22%7D%5D'.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Attempting to connect to SSE endpoint 'http://localhost:29858/signalr/connect?transport=serverSentEvents&clientPro…2Bxa%2Fe2uZd4&connectionData=%5B%7B%22name%22%3A%22tcardhub%22%7D%5D&tid=8'.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: EventSource connected.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: serverSentEvents transport selected. Initiating start request.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: The start request succeeded. Transitioning to the connected state.
jquery.signalR-2.1.2.js:81 [11:49:30 GMT-0600 (Mountain Daylight Time)] SignalR: Now monitoring keep alive with a warning timeout of 13333.333333333332 and a connection lost timeout of 20000.
错误发生在IE和Chrome中。我正在使用具有更高安全性的工作笔记本电脑,因此我认为可能存在一些破坏事物的安全设置。
答案 0 :(得分:0)
我通过将传输更改为“auto”而不是使用“webSockets”来修复此问题。我不知道为什么网络套接字不能在一台计算机上运行,但至少现在已经解决了这个问题。