C# SignalR 2.2.0:客户端无法调用集线器,集线器不';我没接到电话

C# SignalR 2.2.0:客户端无法调用集线器,集线器不';我没接到电话,c#,asp.net-mvc-5,signalr,signalr-hub,signalr.client,C#,Asp.net Mvc 5,Signalr,Signalr Hub,Signalr.client,一切正常,但现在不是:)我一直在查看我的源代码管理,但我无法找出哪里出了问题。我没有收到错误,并且在调试时很难找出哪里出了问题。调用集线器的客户端命令被调用,但集线器从未被调用。不知道为什么 <!--Reference the SignalR library. --> <script src="~/Scripts/jquery.signalR-2.2.0.min.js"></script> <!--Reference the autogenerated

一切正常,但现在不是:)我一直在查看我的源代码管理,但我无法找出哪里出了问题。我没有收到错误,并且在调试时很难找出哪里出了问题。调用集线器的客户端命令被调用,但集线器从未被调用。不知道为什么

<!--Reference the SignalR library. -->
<script src="~/Scripts/jquery.signalR-2.2.0.min.js"></script>
<!--Reference the autogenerated SignalR hub script. -->
<script src="~/signalr/hubs"></script>
永远不会调用UpdateInstallProgress(字符串installID):(

下面是客户端在JS中调用服务器的地方。虽然会调用此服务器,但不会调用集线器

connection.server.updateInstallProgess(@ViewBag.installID);
不要担心正文中的内容,下面是从未调用过的客户端JS代码!这是因为从未调用hub来调用此客户端代码

    var connection = $.connection.updateInstallHub;  

    connection.client.updateInstallProgess = function (installID) {
        //code that never gets called :(
    };
下面是Startup.cs

using Owin;
using Microsoft.Owin;
[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();       //mapping the SignalR hubs to the http routes
        }
    }
}

为什么没有调用集线器?我怀疑这与我的包/引用有关,但除了重新安装我前面提到的包之外,我不知道如何修复它。如果有任何想法,我们将不胜感激!

在您显示的js代码中,您似乎没有启动连接。

打开日志记录,看看发生了什么事情n、 您没有显示客户端代码-例如-我甚至看不到您启动了连接。像这样打开日志记录?connection.logging=true;您能给我一个示例,说明客户端代码“启动连接”是什么吗会是什么样子?谢谢你的回答这里有一个很棒的教程谢谢你Pawel,我会再看一看。我想我可能是不小心改变了什么,因为我以前让它工作过。Pawel,你是对的。我丢失了$.connection.hub.start()。完成(函数()……在合并中。我希望你发布一个答案,这样我就可以给你rep+。如果你回答这个问题,我会:)
    var connection = $.connection.updateInstallHub;  

    connection.client.updateInstallProgess = function (installID) {
        //code that never gets called :(
    };
using Owin;
using Microsoft.Owin;
[assembly: OwinStartup(typeof(SignalRChat.Startup))]
namespace SignalRChat
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();       //mapping the SignalR hubs to the http routes
        }
    }
}