SignalR /signalr/hubs 404 Not Found

前端 未结 14 1412
时光说笑
时光说笑 2020-12-29 03:16

I am trying to deploy a SignalR site on IIS. Code all works fine in VS. But getting the 404 not found error trying to resolve signalr/hubs so far I have tri

14条回答
  •  误落风尘
    2020-12-29 03:56

    The order of route registration matters. I had this exact problem and fixed it by ensuring my global.asax.cs looked like this:

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteTable.Routes.MapHubs();
    
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
    }
    

    This was in a web site using SignalR, MVC and WebApi all together.

提交回复
热议问题