SignalR and MVC bundle

后端 未结 5 1198
迷失自我
迷失自我 2020-12-15 17:52

I\'m trying to use SignalR with MVC bundle, but having problem finding out how to include the /signalr/hubs script into the bundle. For now I have to insert the path in betw

5条回答
  •  粉色の甜心
    2020-12-15 18:06

    I know this is an old thread but I would like to add the following for SignalR 2.x. I really wanted to bundle the proxy using SquishIt and by trial and error I managed to come up with the following:

    using Microsoft.AspNet.SignalR
    using Microsoft.AspNet.SignalR.Hubs
    
    var resolver = new DefaultHubManager(new DefaultDependencyResolver());
    var proxy = new DefaultJavaScriptProxyGenerator(resolver, new NullJavaScriptMinifier());
    string iCanHazScriptNao = proxy.GenerateProxy("/signalr");
    

提交回复
热议问题