2022-05-01 16:25:03 +08:00
|
|
|
|
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Sample
|
2021-12-28 14:05:39 +08:00
|
|
|
|
{
|
|
|
|
|
public class WebApiApplication : HttpApplication
|
|
|
|
|
{
|
|
|
|
|
private Hangfire.BackgroundJobServer _backgroundJobServer;
|
|
|
|
|
|
|
|
|
|
protected void Application_Start()
|
|
|
|
|
{
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 注册 WebAPI 区域
|
2021-12-28 14:05:39 +08:00
|
|
|
|
AreaRegistration.RegisterAllAreas();
|
|
|
|
|
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 注册 WebAPI 配置
|
2021-12-28 14:05:39 +08:00
|
|
|
|
GlobalConfiguration.Configure(WebApiConfiguration.Register);
|
|
|
|
|
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 注册全局过滤器
|
2021-12-28 14:05:39 +08:00
|
|
|
|
FilterRegistration.RegisterGlobalFilters(GlobalFilters.Filters);
|
|
|
|
|
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 注册路由表
|
2021-12-28 14:05:39 +08:00
|
|
|
|
RouteRegistration.RegisterRoutes(RouteTable.Routes);
|
|
|
|
|
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 初始化 Autofac 依赖注入容器
|
2021-12-28 14:05:39 +08:00
|
|
|
|
AutofacInitializer.Init();
|
|
|
|
|
|
2022-05-01 16:25:03 +08:00
|
|
|
|
// 初始化 Hangfire 定时任务
|
2021-12-28 14:05:39 +08:00
|
|
|
|
_backgroundJobServer = HangfireInitializer.Init();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Application_End()
|
|
|
|
|
{
|
|
|
|
|
_backgroundJobServer?.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|