为什么我会收到此错误:
myhub.cs:
public class ChatHub : Hub
{
private static DataTable ConnectedClientDt = null;
public void ConnectClient(string ClientName)
{
if (ConnectedClientDt == null)
{
ConnectedClientDt = new DataTable();
ConnectedClientDt.Columns.Add("ClienID");
ConnectedClientDt.Columns.Add("ClientName");
}
ConnectedClientDt.Rows.Add(Context.ConnectionId,ClientName);
}
ClientSide:
$(document).ready(function () {
var chat = $.connection.chatHub;
var clientName = '<%=Session["ClientName"] %>';
$.connection.hub.start().done(function () {
chat.server.ConnectClient(clientName);
});
任何帮助,请
答案 0 :(得分:0)
将名称更改为小写。 ConnectClient应该是connectClient。一开始我们可以制作名称javascript友好名称(驼峰案例)
,这可能令人困惑