我是新来的signalr。我创建了一个开箱即用的MVC 4.0应用程序,并在索引视图中连接了我的signalr JavaScript。当我单击注册或登录按钮时,signalr会引发JavaScript错误。SignalR投掷JavaScript错误
Unhandled exception at line 11, column 10700 in http://localhost:49172/Scripts/jquery.signalR- 0.5.1.min.js
0x800a138f - Microsoft JScript runtime error: Unable to set value of the property 'src': object is null or undefined
任何建议表示赞赏。
编辑:
这是我的代码的程度:
$(function() {
var blasht = $.connection.blashtHub;
blasht.addMessage = function (message) {
$('#messages').append('<li>' + message + '');
};
$("#blashtIt").click(function() {
var control = $('#blashtText');
var control2 = $('#hiddenUserId');
// Call the chat method on the server
blasht.send(control2.val(), control.val());
control.val('');
});
blasht.updateTopTen = function (message) {
//add code to update the top user's list
};
// Start the connection
$.connection.hub.start();
});
如所建议予下降最小和此处在那里崩溃,在frame.sc = SRC;线。
reconnect: function (connection) {
var that = this;
window.setTimeout(function() {
var frame = connection.frame,
src = transportLogic.getUrl(connection, that.name, true) + "&frameId=" + connection.frameId;
connection.log("Upating iframe src to '" + src + "'.");
frame.src = src;
}, connection.reconnectDelay);
},
SignalR,不是我,正在调用这个重新连接函数。显然,这就是它如何维护与服务器的连接。
你必须证明你的代码,特别是设置了'src'属性的代码,以及,让你无论是对象的代码设置'src'属性。 –
这个特定的bug已修复,因此请升级SignalR :) – davidfowl