| | |
| | | { |
| | | // 有关如何配置应用程序的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkID=316888 |
| | | //允许跨域 |
| | | app.UseCors(CorsOptions.AllowAll); |
| | | //app.UseCors(CorsOptions.AllowAll); |
| | | //app.MapSignalR("Hubs/chatHub", new HubConfiguration()); |
| | | app.MapSignalR(); |
| | | //app.MapSignalR(); |
| | | //自己设定访问路径,同时设置Hub配置项,无需指定启动的Hub类,因为它们被自动识别 |
| | | |
| | | // 连接标识 |
| | | //app.Map("/signalr", map => |
| | | //{ |
| | | // //跨域 |
| | | // map.UseCors(CorsOptions.AllowAll); |
| | | // var hubConfiguration = new HubConfiguration |
| | | // { |
| | | // EnableJSONP = true |
| | | // }; |
| | | // //启动配置 |
| | | // map.RunSignalR(hubConfiguration); |
| | | //}); |
| | | |
| | | |
| | | // 连接标识 |
| | | app.Map("/signalr", map => |
| | | { |
| | | //跨域 |
| | | map.UseCors(CorsOptions.AllowAll); |
| | | var hubConfiguration = new HubConfiguration |
| | | { |
| | | EnableJSONP = true |
| | | }; |
| | | //启动配置 |
| | | map.RunSignalR(hubConfiguration); |
| | | }); |
| | | } |
| | | } |
| | | } |