SignalR: Error loading hubs

前端 未结 4 1801
萌比男神i
萌比男神i 2021-02-13 20:57

Signalr doesn\'t load my hubs:

SignalR: Error loading hubs. Ensure your hubs reference is correct, e.g. . 
         


        
4条回答
  •  萌比男神i
    2021-02-13 21:24

    Server has to know where your startup class is

    One option is like Rob wrotes:

    [assembly: OwinStartup(typeof(MyStartupClass))]
    

    But there are other possibilies up to your requiremens. From Microsoft Docs (docs.microsoft.com/en-us/aspnet/core/fundamentals/startup):

    Alternatively, you can define a fixed Startup class that will be used regardless of the environment by calling UseStartup. This is the recommended approach.

    Example:

    public class Program
        {
            public static void Main(string[] args)
            {     
              BuildWebHost(args).Run();   
            }
    
            public static IWebHost BuildWebHost(string[] args) =>
                WebHost.CreateDefaultBuilder(args)
                    .UseStartup()
                    .Build();
        }
    

提交回复
热议问题