I have been using SignalR from an earlier version and am updating along the way, however, I deployed my application on my working Windows Server 2008 R2 server, and now the application crashes with "The hub cannot be resolved." an exception.
edit: StackTrace Added:
[InvalidOperationException: 'stockitems' Hub could not be resolved.] Microsoft.AspNet.SignalR.Hubs.HubManagerExtensions.EnsureHub(IHubManager hubManager, String hubName, IPerformanceCounter[] counters) +426 Microsoft.AspNet.SignalR.Hubs.HubDispatcher.Initialize(IDependencyResolver resolver, HostContext context) +716 Microsoft.AspNet.SignalR.Owin.CallHandler.Invoke(IDictionary`2 environment) +1075 Microsoft.AspNet.SignalR.Owin.Handlers.HubDispatcherHandler.Invoke(IDictionary`2 environment) +363 Microsoft.Owin.Host.SystemWeb.OwinCallContext.Execute() +68 Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object extraData) +414 [TargetInvocationException: Exception has been thrown by the target of an invocation.] Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +146 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
On my dev machine and local test server I have no problem.
The node in question is really simple:
[HubName("StockItems")] public class StockItemHub : Hub { }
I initially thought this was a problem with HubName, so I deleted it, but it still explodes.
I initially thought this was due to dependency injection, so I changed my Global.asax to look like this:
var signalRResolver = new SignalRDependencyResolver(); GlobalHost.DependencyResolver = signalRResolver; var configuration = new HubConfiguration { Resolver = signalRResolver }; RouteTable.Routes.MapHubs(configuration); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters, config.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles);
edit: what is SignalRDependencyResolver? SignalRDependencyResolver did not exist until I tried to solve this problem. Since I believe this is a dependency nesting problem, I wrapped DefaultDependencyResolver by overriding GetService and GetServices to check my Ninject kernel for this type first, and if not returning to DefaultDependencyResolver
Any ideas?
The server runs IIS7, Windows Server 2008 with .Net 4.5 The application is an MVC 4.Net 4.5