public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <SenparcSetting> senparcSetting, IOptions <SenparcWeixinSetting> senparcWeixinSetting) { app.UseAbp(); //Initializes ABP framework. app.Use(async(context, next) => { if (context.Request.Path.Value.ToLower().Contains("api/services")) { //context.Response.Headers[HeaderNames.CacheControl] = "no-cache"; context.Response.GetTypedHeaders().CacheControl = new Microsoft.Net.Http.Headers.CacheControlHeaderValue() { NoCache = true }; } await next(); }); app.UseSession(); //app.UseSignalR(routes => //{ // routes.MapHub<ChatHub>("/signalr-ChatHub"); //}); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); } app.UseAuthentication(); app.UseJwtTokenMiddleware(); //自定义中间件 app.UseThumbMiddleware(); app.UseStaticFiles(new StaticFileOptions() { ServeUnknownFileTypes = true }); app.UseEmbeddedFiles(); //Allows to expose embedded files to the web! ApplicationConfigurer.Configure(app); app.UseHangfireServer(); app.UseHangfireDashboard("/masterhangfire", new DashboardOptions { Authorization = new[] { new AbpHangfireAuthorizationFilter() } }); app.UseSwagger(); // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.) app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "Master API V1"); }); // URL: /swagger app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // 启动 CO2NET 全局注册,必须! IRegisterService register = RegisterService.Start(env, senparcSetting.Value) //关于 UseSenparcGlobal() 的更多用法见 CO2NET Demo:https://github.com/Senparc/Senparc.CO2NET/blob/master/Sample/Senparc.CO2NET.Sample.netcore/Startup.cs .UseSenparcGlobal(); #region 微信相关配置 /* 微信配置开始 * * 建议按照以下顺序进行注册,尤其须将缓存放在第一位! */ //注册开始 //开始注册微信信息,必须! register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value) //注意:上一行没有 ; 下面可接着写 .RegisterXX() #region 注册公众号或小程序(按需) //注册公众号(可注册多个) .RegisterMpAccount(senparcWeixinSetting.Value, "公众号") //除此以外,仍然可以在程序任意地方注册公众号或小程序: //AccessTokenContainer.Register(appId, appSecret, name);//命名空间:Senparc.Weixin.MP.Containers #endregion ; /* 微信配置结束 */ #endregion }
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IOptions <SenparcSetting> senparcSetting, IOptions <SenparcWeixinSetting> senparcWeixinSetting) { app.UseAbp(); //Initializes ABP framework. app.UseSession(); //app.UseSignalR(routes => //{ // routes.MapHub<ChatHub>("/signalr-ChatHub"); //}); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Error"); } //自定义中间件 app.UseThumbMiddleware(); app.UseStaticFiles(); app.UseEmbeddedFiles(); //Allows to expose embedded files to the web! app.UseAuthentication(); app.UseJwtTokenMiddleware(); ApplicationConfigurer.Configure(app); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // 启动 CO2NET 全局注册,必须! IRegisterService register = RegisterService.Start(env, senparcSetting.Value) //关于 UseSenparcGlobal() 的更多用法见 CO2NET Demo:https://github.com/Senparc/Senparc.CO2NET/blob/master/Sample/Senparc.CO2NET.Sample.netcore/Startup.cs .UseSenparcGlobal(); #region 微信相关配置 /* 微信配置开始 * * 建议按照以下顺序进行注册,尤其须将缓存放在第一位! */ //注册开始 //开始注册微信信息,必须! register.UseSenparcWeixin(senparcWeixinSetting.Value, senparcSetting.Value) //注意:上一行没有 ; 下面可接着写 .RegisterXX() #region 注册公众号或小程序(按需) //注册公众号(可注册多个) .RegisterMpAccount(senparcWeixinSetting.Value, "公众号") //除此以外,仍然可以在程序任意地方注册公众号或小程序: //AccessTokenContainer.Register(appId, appSecret, name);//命名空间:Senparc.Weixin.MP.Containers #endregion ; /* 微信配置结束 */ #endregion }