public RedisSubscribeTests() { InitConfig.Init(); }
public AliyunSubscribeTests() { InitConfig.Init(); }
public RedisCacheTest() { InitConfig.Init(); }
public DefaultStringLocalizerTest() { InitConfig.Init(); }
public LogTests() { InitConfig.Init(); }
public RabbitMQSubscribeTests() { InitConfig.Init(); }
public XmlStringLocalizerTest() { InitConfig.Init(); }
public Log4netTests() { InitConfig.Init(); }
public MEFTests() { InitConfig.Init(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IMsgReceive msgHandler, IApplicationLifetime applicationLifetime) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); app.UseHsts(); } InitConfig.Init(app.ApplicationServices); //日志记录中间件 //repository = LogManager.CreateRepository("NETCoreRepository"); //XmlConfigurator.Configure(repository, new FileInfo("log4net.config")); app.UseStatusCodePages(); app.UseStaticFiles(); #region websocket #region 基础websocket //var webSocketOptions = new WebSocketOptions() //{ // KeepAliveInterval = TimeSpan.FromSeconds(120), // ReceiveBufferSize = 4 * 1024 //}; //app.UseWebSockets(webSocketOptions); //app.UseCustomWebSocketManager(); #endregion #region SignalR //初始化数据库 // 使用SignalR 并添加MessageHub类的消息处理器 //app.UseSignalR(r => //{ // r.MapHub<MessageHub>("/messagehub", options => options.WebSockets.SubProtocolSelector = requestedProtocols => // { // return requestedProtocols.Count > 0 ? requestedProtocols[0] : null; // }); //}); #endregion #endregion app.UseSession(); //gzip压缩中间件 app.UseResponseCompression(); //Response 缓存中间件 app.UseResponseCaching(); #region Cors //app.UseCors("SANS跨域策略"); #endregion app.UseMvc(routes => { routes.MapRoute( name: "areas", template: "{area:exists}/{controller}/{action=Index}/{id?}" ); routes.MapRoute( name: "default", template: "{controller=User}/{action=Login}/"); }); // 应用启动时开始处理消息 applicationLifetime.ApplicationStarted.Register(msgHandler.receiveMsg); applicationLifetime.ApplicationStopping.Register(msgHandler.stopMsg); // 应用退出时,释放资源 #region Swagger //app.UseSwagger(); //app.UseSwaggerUI(c => //{ // c.SwaggerEndpoint("/swagger/v1/swagger.json", "KNAPI"); //}); #endregion }