SignalR Self Host - 调用目标抛出了异常

时间:2014-11-27 13:49:06

标签: signalr owin

我在窗口服务中实现了signalR,下面是代码。

private IDisposable SignalR { get; set; }

public void Configuration(IAppBuilder app)
{   
        var hubconfig=new Microsoft.AspNet.SignalR.HubConfiguration();
        hubconfig.EnableJSONP = true;

        app.UseCors(CorsOptions.AllowAll);
        app.MapSignalR(hubconfig);
}


private void StartSignalRServer(StringBuilder sbLog)
{
        try
        {
            this.SignalR = WebApp.Start(ServerURI); //This throws exception

            //this.SignalR= WebApp.Start<Startup>(ServerURI);
            sbLog.Append(string.Format("{0}--------SignalR Server Started------",Environment.NewLine));
        }
        catch (Exception ex)
        {
            sbLog.Append(string.Format("{0}Exception in StartSignalRServer=>{1}", Environment.NewLine,ex.Message));
        }
}

以下是抛出的异常:

Exception in StartSignalRServer=>Exception has been thrown by the target of an invocation.
Stack Trace:   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at Owin.Loader.DefaultLoader.<>c__DisplayClass1.<LoadImplementation>b__0(IAppBuilder builder)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   at Microsoft.Owin.Hosting.Starter.HostingStarter.Start(StartOptions options)
   at RequestNajmWinService.RequestNajmServicecs.StartSignalRServer(StringBuilder sbLog)

0 个答案:

没有答案