问题
I am using SignalR version 1.2.2 with ASP.NET MVC 4. I set the signalR connections to a page inside a defined "Area" Regardless though, this seems to come at the SignalR script load. Because if I access a view defined in the main area outside of the areas sections, I still get this error:
System.Web.HttpException (0x80004005): The controller for path '/function () { _pageLoaded = true; }' was not found or does not implement IController. at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType) at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName) at System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I found, /function () { _pageLoaded = true; } inside jquery.signalR-1.2.2.js as _pageWindow.load(function () { _pageLoaded = true; });
I have followed this tutorial: Tutorial which uses a singleton to maintain a instance of the Context for the hub. what could I be doing wrong?
Update: when I remove the script reference to the SignalR js file from the head the error goes away, so I can confidently say it is SignalR related.
回答1:
Hmm, looks like it's because of my later version of JQuery: JQuery 3 and SignalR 2.2.0
Updating:
_pageWindow.load(function () { _pageLoaded = true; });
To :
_pageWindow.on("load",function () { _pageLoaded = true; });
inside the jquery.singalR file solved my problem.
来源:https://stackoverflow.com/questions/44162397/signalr-version-1-2-2-getting-error-the-controller-for-path-function-pa