我试图在我的索引页面上显示信号 r 消息。以下集线器详细信息
public class TasksHub : Hub
{
public void NewTaskDetails(int taskid,string taskname,string created,string role)
{
Clients.All.addMessage(taskid, taskname, created, role);
}
}
my error is : Unhandled exception at line 60, column 9 in http://localhost:45845/
0x800a138f-JavaScript runtime error:
无法获取未定义或空引用的属性 TasksHub
<script src="~/Scripts/jquery-1.8.2.js"></script>
<script src="~/Scripts/jquery.signalR-1.1.0.js"></script>
<script src="~/signalr/hubs"></script>
<script type="text/javascript">
$(function ()
{
var THub = $.connection.TasksHub;
$messages = $("#messages");
THub.client.send = function (taskid, taskname, created, role) {
$messages.append("<br /><b>" + taskid + ":</b>" + taskname);
}
$.connection.THub.start();
});