Signalr Hub in Separate Dll

被刻印的时光 ゝ 提交于 2019-12-01 11:21:30
joeriks

This worked for me (in startup)

AppDomain.CurrentDomain.Load(typeof(MyHub).Assembly.FullName);

Credits to map hubs in referenced project

Try to see the http response message

        try
        {
            hubConnection.Start().Wait();
        }
        catch (Exception error)
        {
            if (error.InnerException is WebException)
            {
                WebException webError = (WebException)error.InnerException;
                Console.WriteLine(webError.Status);
                Console.WriteLine(webError.Response);
            }
        }

Have you moved your call to register your hubs to the new dll? I.e. the following needs to be in your new project (but still called from global.asax):

RouteTable.Routes.MapHubs();

You probably also need to use the [WebActivator PreApplicationStart attribute] (http://msdn.microsoft.com/en-us/library/system.web.preapplicationstartmethodattribute.aspx) in the new RegisterHubs class to ensure it is registered in time

Make sure the separate DLL has a reference to Microsoft.CSharp.dll - which is required for dynamic code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!