问题
Duplicate of Error loading hubs. Ensure your hubs reference is correct, e.g. <script src='/signalr/js'></script>
But no answer yet. Please help.
回答1:
Mine was a stupid mistake! Hope this might help others in future. I have AngularJS front end and C# Web API back end. So my routing was in Angular and Web API had a routing to make sure that angular does all the routing. So in my Global.asax file, the code was as follows
string url = Request.Url.LocalPath;
if (!System.IO.File.Exists(Context.Server.MapPath(url)) && !url.Contains("/api/"))
Context.RewritePath("/View/app/index.html");
I updated it as
string url = Request.Url.LocalPath;
if (!System.IO.File.Exists(Context.Server.MapPath(url)) && !url.Contains("/api/") && !url.Contains("/signalr") )
Context.RewritePath("/View/app/index.html");
Now one problem is solved.
来源:https://stackoverflow.com/questions/43730985/angular-c-sharp-webapi-signalr-error-loading-hubs-ensure-your-hubs-reference