SignalR version 1.2.2 getting Error: The controller for path '/function () { _pageLoaded = true; }' was not found or does not implement IController

夙愿已清 提交于 2019-12-12 04:45:22

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!