protected void Application_Start() { logManager.Info("应用程序启动"); MvcHandler.DisableMvcResponseHeader = false; //强制检测移动端 DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile") { ContextCondition = (context => regMobile.IsMatch(HttpContext.Current.Request != null ? HttpContext.Current.Request.UserAgent ?? "" : "")) }); //regMobile.IsMatch(HttpContext.Current.Request.UserAgent); BundleTable.EnableOptimizations = true;//如果要配置压缩,把这里设置成true(或者把web.config里面的debug设置为false) #if DEBUG BundleTable.EnableOptimizations = false; #endif AreaRegistration.RegisterAllAreas(); WebApiConfig.Register(GlobalConfiguration.Configuration); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //加载配置文件 ConfigTable.LoadConfig(Server.MapPath("~/config.json")); /*默认加载IP查询库*/ Helper.IP.Load(Server.MapPath(ConfigTable.Table[ConfigEnum.SourceDataIP])); //启动的时候创建所有路径 FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceBlogPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceBlogThumbnailPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceIconsPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceMusicImagePath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceSaidPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceSaidThumbnailPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceSystemPath)); FileCommon.ExistsCreate(Server.MapPath(ConfigInfo.SourceSystemThumbnailPath)); }