4

I'm working on Asp.net MVC app, I'd like to use signalr.

Signalr to be hosted in IIS.

I added the signalr dlls and added the reference to it.

In Global.asax,

I put the code,

inside Application_Start()

 " RouteTable.Routes.MapHubs();"

I've pasted the Global.asax,

  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Http;
  using System.Web.Mvc;
  using System.Web.Optimization;
  using System.Web.Routing;

public class MvcApplication : System.Web.HttpApplication
{
    protected void Application_Start()
    {
        AreaRegistration.RegisterAllAreas();

        WebApiConfig.Register(GlobalConfiguration.Configuration);
        FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
        RouteConfig.RegisterRoutes(RouteTable.Routes);
        BundleConfig.RegisterBundles(BundleTable.Bundles);
        AuthConfig.RegisterAuth();
        RouteTable.Routes.MapHubs();
    }
}

When i run the app, say, "http://localhost:4432",

When I try "http://localhost:4432/signalr/hubs", I get exception as follows,

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /signalr/hubs

Signalr version : I tried with V1.1.25 and 2.0

Someone direct me what I should do to get it corrected?

6
  • What version of SignalR is it you are using? Commented Jan 10, 2014 at 9:35
  • I wanted to ask the same, please share your signalR version. There is a boatload of "how to get started with signalR" tutorials out there, look for one that uses the same version as you. Commented Jan 10, 2014 at 9:40
  • @SoonDead I tried, version 1.1.25 and version 2.0... Commented Jan 10, 2014 at 9:59
  • You tried adding using Microsoft.AspNet.SignalR; to your namespaces? Commented Jan 10, 2014 at 10:09
  • @Tim B James In Global.asax? Commented Jan 10, 2014 at 10:13

2 Answers 2

3

1.write a hub extends Hub

public class MessageHub : Hub

2.check web.config

<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
Sign up to request clarification or add additional context in comments.

2 Comments

I tried it, still getting, exception, ..................... Server Error in '/' Application. The resource cannot be found. Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly. Requested URL: /signalr/hubs
try move RouteTable.Routes.MapHubs(); to the first line;i can't remenber if it has same conflict with mvc or web api route
2

I tried,

  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Http;
  using System.Web.Mvc;
  using System.Web.Optimization;
  using System.Web.Routing;

  public class MvcApplication : System.Web.HttpApplication
  {
  protected void Application_Start()
   {
    RouteTable.Routes.MapHubs();
    AreaRegistration.RegisterAllAreas();

    WebApiConfig.Register(GlobalConfiguration.Configuration);
    FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
    RouteConfig.RegisterRoutes(RouteTable.Routes);
    BundleConfig.RegisterBundles(BundleTable.Bundles);
    AuthConfig.RegisterAuth();

}
}

Put "RouteTable.Routes.MapHubs();" in the first line of Application_Start() method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.