Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 名称更改时出现信号器错误_C#_Jquery_Asp.net_Signalr_Jscript - Fatal编程技术网

C# 名称更改时出现信号器错误

C# 名称更改时出现信号器错误,c#,jquery,asp.net,signalr,jscript,C#,Jquery,Asp.net,Signalr,Jscript,所以我刚开始试着和信号员一起做一个我正在做的项目。我在JScript或Jquery方面的经验很少,但在C方面的经验相当丰富# 我为一个聊天应用程序制作了微软文档的教程项目 因此,在大多数人看来,这可能是一个相当愚蠢的问题 在我替换的脚本中 chat.server.Send($('#displayname').val(), $('#message').val()); 与 并在集线器中添加了该功能 public void GetServerName(string name, string mess

所以我刚开始试着和信号员一起做一个我正在做的项目。我在JScript或Jquery方面的经验很少,但在C方面的经验相当丰富#

我为一个聊天应用程序制作了微软文档的教程项目

因此,在大多数人看来,这可能是一个相当愚蠢的问题

在我替换的脚本中

chat.server.Send($('#displayname').val(), $('#message').val());

并在集线器中添加了该功能

public void GetServerName(string name, string message)
{
    // Call the broadcastMessage method to update clients.
    Clients.All.broadcastMessage(name, message);
}
但我得到了以下错误

未捕获类型错误:chat.server.GetServerName不是函数

如果项目的其余部分都是相同的,那么这是如何发生的呢


很抱歉,如果这是重复的,我已经找了将近5个小时了,我知道我的问题在其他地方没有合理的答案。

通常,从SignalR客户端调用时,您需要以小写字母启动方法名称

chat.server.getServerName($('#displayname').val(), $('#message').val());

GetServerName替换为GetServerName

使用中心的invoke方法从客户端调用服务器方法:

yourHub.Invoke("GetServerName", $('#displayname').val(), $('#message').val());

请尝试清理并重新构建解决方案,可能尚未检测到中心中的更改可能需要在chat.server.getServerName($('#displayname').val(),$('#message').val()中使用小写的G@Rudeshappa是的,我隐约记得不久前测试我的信号器应用程序时出现了外壳问题。好地方
yourHub.Invoke("GetServerName", $('#displayname').val(), $('#message').val());