当我运行$.connection.hub.start()
时,我从“资源”中获取了这些错误(我追踪它)。
这些是我遇到的错误
errorOnNegotiate -> "Error during negotiation request.".
errorParsingNegotiateResponse -> "Error parsing negotiate response.".
errorSourceError -> "Error raised by EventSource".
eventSourceFailedToConnect -> "EventSource failed to connect.".
longPollFailed -> "Long polling request failed.".
noConnectionTransport -> "Connection is in an invalid state, there is
no transport active.". nojQuery -> "jQuery was not found. Please
ensure jQuery is referenced before the SignalR client JavaScript
file.". noTransportOnInit -> "No transport could be initialized
successfully. Try specifying a different transport or none at all for
auto initialization.".
答案 0 :(得分:0)
部分错误是:“找不到jQuery。请确保在SignalR客户端JavaScript文件之前引用jQuery。”“
你需要添加jQuery引用,这可以这样做(请注意,在这个示例中,signalR版本是2.0.2,你需要添加对你正在使用的版本的正确引用):
<!--Reference the jQuery library. -->
<script src="Scripts/jquery-1.6.4.min.js"></script>
<!--Reference the SignalR library. -->
<script src="Scripts/jquery.signalR-2.0.2.min.js"></script>
答案 1 :(得分:0)
看起来你已经在signalR ._。error()中粘贴了资源对象的内容。该对象包含可能的错误列表,而不是您得到的错误。例如,这里用于在无法解析协商响应时获取错误消息:
try {
res = connection._parseResponse(result);
} catch (error) {
onFailed(signalR._.error(resources.errorParsingNegotiateResponse, error), connection);
return;
}
要查看您实际获得的错误,请查看代码尝试从此对象中使用的内容。