/// <summary>
 /// 应用程序结束
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void Application_End(object sender, EventArgs e)
 {
     try
     {
         HttpApplication app = (HttpApplication)sender;
         //自定义应用程序结束
         SysApplicationHandle.Application_End(app);
     }
     catch { }
 }
        /// <summary>
        /// 应用程序启动
        /// </summary>
        public void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //启动自动处理程序
            AutoProcessTask.EventAfterExecute += new EventHandler(SysAutoHandle.SysBackgroundTaskAdd);
            AutoProcessTask.Execute();
            //用户扩展对象
            UserExtendEventHandler.BindUserExtendEvent += new UserExtendEventHandler.EventUserExtend(UserExtendHandle.GetUserExtendObject);
            //自定义应用程序启动
            SysApplicationHandle.Application_Start(this.Application);
            //验证配置
            ConfigureFluentValidation();
            //注册视图访问规则
            RegisterView();
        }
Example #3
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            //异常信息页处理
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            //全局配置
            app.UseWkMvcDI();
            //静态资源
            var provider = new FileExtensionContentTypeProvider();

            provider.Mappings[".properties"] = "application/octet-stream";
            provider.Mappings[".bcmap"]      = "application/octet-stream";
            app.UseStaticFiles(new StaticFileOptions()
            {
                FileProvider        = new PhysicalFileProvider(env.ContentRootPath),
                RequestPath         = new PathString(string.Empty),
                ContentTypeProvider = provider
            });
            //跨域处理
            app.UseCors(builder => builder.WithOrigins("*").AllowAnyHeader().AllowAnyMethod());
            //开启目录浏览
            app.UseDirectoryBrowser();
            //session
            app.UseSession();
            //mvc注册路由
            app.UseMvc(routes =>
            {
                RouteConfig.RegisterRoutes(routes, app.ApplicationServices); //注册路由
            });
            //加载程序集
            TryLoadAssembly();
            //自定义应用程序启动
            SysApplicationHandle.Application_Start();
        }