2013-03-23 151 views
3

我在MVC 3.0 Windows Azure應用程序中使用SignalR。 以下代碼行僅在Windows Azure模擬器中引發ArgumentNullException。它不會拋出如果我運行MVC 3.0應用程序而不是雲應用程序。 (我沒有嘗試在已部署的雲中運行此代碼)。RouteTable.Routes.MapHubs()僅在Windows Azure模擬器中拋出ArgumentNullException。爲什麼?

public static void RegisterRoutes(RouteCollection routes) 
{ 
    RouteTable.Routes.MapHubs(); 
    // ... 
} 

消息Value cannot be null. Parameter name: instanceName旁邊的錯誤沒有附加信息。我不知道它是什麼實例名稱。

我不知道什麼可能是錯的。 爲什麼會發生?

編輯

這是完整的異常信息:

System.ArgumentNullException了未處理的HResult = -2147467261
消息=值不能爲空。參數名稱:實例名
源= Microsoft.AspNet.SignalR.Core PARAMNAME =實例名
堆棧跟蹤: 在Microsoft.AspNet.SignalR.Hosting.HostDependencyResolverExtensions.InitializeHost(的IDependencyResolver 分解器,字符串實例名,的CancellationToken hostShutdownToken) 在Owin。 OwinExtensions.UseType [T](IAppBuilder builder,Object [] args) at Owin.OwinExtensions.MapHubs(IAppBuilder builder,String path,HubConfiguration configuration) at System.Web.Routing.SignalRRouteExtensions。 <> C_ DisplayClass7.b _5(IAppBuilder 地圖) 在Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(動作1 startup) at Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action 1啓動) 在System.Web.Routing.RouteCollectionExtensions.MapOwinPath(RouteCollection 路線,字符串名,字符串pathBase,Action`1啓動) 在System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection 路線,字符串名稱,字符串路徑,HubConfiguration配置) 在System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection 路由,字符串路徑,HubConfiguration配置) at System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection 條路線,HubConfiguration配置) 在System.Web.Routing.SignalRRouteExtensions.MapHubs(RouteCollection 路由) 在Cerebello.MvcApplication.RegisterRoutes(RouteCollection路由)在 C:\ Projetos \小腦\小腦\ CerebelloWebRole \ Global.asax中。 CS:線在CerebelloWebRole.Code.Helpers.RouteHelper.RegisterAllRoutes()在 C:\ Projetos \小腦\小腦\ CerebelloWebRole \代碼\助手\ RouteHelper.cs:線在CerebelloWebRole.WebRole.Run( )在Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.StartRoleInternal() 在Microsoft.WindowsAzur中的c:\Projetos \ Cerebello \ Cerebello \ CerebelloWebRole \ WebRole.cs中:第23行 e.ServiceRuntime.RoleEnvironment.StartRole() 在Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__2() 在System.Threading.ExecutionContext.RunInternal(的ExecutionContext 的ExecutionContext,ContextCallback回調,對象的狀態,布爾 preserveSyncCtx)系統處的 。Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state,Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback callback,Object state) at System.Threading.ThreadHelper.ThreadStart()InnerException :

+0

你能在github上提交錯誤嗎? – davidfowl 2013-03-24 04:54:17

回答

1

看來MapHubs()被調用到IIS進程之外,現在不允許。如果您有註冊路由的方法,並且它在IIS內外運行的代碼之間共享,則必須確保MapHubs()僅在IIS中調用。

3

不幸的是,這是一個已知的問題:https://github.com/SignalR/SignalR/issues/1616

請隨意對這個問題發表評論。知道這個錯誤發生在Windows Azure模擬器中是有用的。如果您發現這個問題出現在部署中,那也肯定值得注意。

+0

感謝您的回覆。有沒有解決方法讓我停止在模擬器中發生此錯誤?順便說一句,我要在部署中測試它。 – 2013-03-24 11:02:46

相關問題