.NET Core:SignalR

  In the Startup method ConfigureServices configuration:
services.AddSignalR ();

  Cross-domain settings need to change settings:
services.AddCors (Options =>
  options.AddPolicy (AppConfig.DefaultCorsPolicyName, Builder =>
  {
    .. Builder.AllowAnyOrigin () AllowAnyMethod () AllowAnyHeader () AllowCredentials () WithOrigins (AppConfig.Origins.. .toArray ());
  }));

  Configure enable process:
app.UseSignalR (routes =>
{
  routes.MapHub <Chub> ( "/ Hub");
});

  Need to inherit the Hub:
public class Chub: the Hub
{
}

Guess you like

Origin www.cnblogs.com/liusuqi/p/11883231.html