using Microsoft.AspNet.SignalR; using Microsoft.Owin; using Microsoft.Owin.Cors; using Owin; using System; using System.Collections.Generic; using System.Linq; using System.Web; [assembly: OwinStartup(typeof(VueWebApi.App_Start.Startup))] namespace VueWebApi.App_Start { public class Startup { public void Configuration(IAppBuilder app) { // 有关如何配置应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkID=316888 //允许跨域 app.UseCors(CorsOptions.AllowAll); //app.MapSignalR("Hubs/chatHub", new HubConfiguration()); app.MapSignalR(); //自己设定访问路径,同时设置Hub配置项,无需指定启动的Hub类,因为它们被自动识别 } } }