protected void Application_Start(object sender, EventArgs e) { //启动日志模块 Logger.Current.SetLogger = new LogNet(); Logger.Current.IsOpenLog = true; Logger.CurrentLog.Info("INSTALLING"); //设置数据库连接执行状况 AppCons.LogSqlExcu = true; //设置第一个数据库 AppCons.SetDefaultConnect(new MySqlHelper(), ConfigurationManager.AppSettings["ConnectionString"]); //是否需要数据库全局参数化 AppCons.IsParmes = false; //是否数据库操作的缓存 AppCons.IsOpenCache = false; //使用第三方的分布式缓存 //AppCons.CurrentCache =new RedisCache(); //使用内置的webcache缓存 AppCons.CurrentCache = new WebCache(); //注册ajax AppHandlerManager.RegisterAppHandler(new BlackHandler()); AppHandlerManager.RegisterAppHandler(new TemplateHandler()); AppHandlerManager.RegisterAppHandler(new KeyWordHandler()); AppHandlerManager.RegisterAppHandler(new MoHandler()); AppHandlerManager.RegisterAppHandler(new BatchHistoryHandler()); AppHandlerManager.RegisterAppHandler(new PhoneHistoryHandler()); AppHandlerManager.RegisterAppHandler(new UserHandler()); AppHandlerManager.RegisterAppHandler(new ContactGroupHandler()); AppHandlerManager.RegisterAppHandler(new ContactHandler()); AppHandlerManager.RegisterAppHandler(new SmsHandler()); AppHandlerManager.RegisterAppHandler(new AccountHandler()); AppHandlerManager.RegisterAppHandler(new Enterprisehandler()); }
/// <summary> /// 初始化业务逻辑层 /// </summary> /// public static void Init() { //TODO:错误处理,不能因为异常导致程序启动失败 //注册应用程序 AppManager.RegisterApp(new BasicApp()); #region 注册AppHandler AppHandlerManager.RegisterAppHandler(new DownloadHandler()); AppHandlerManager.RegisterAppHandler(new DeleteTempFileHandler()); AppHandlerManager.RegisterAppHandler(new OutputValidateCodeHandler()); AppHandlerManager.RegisterAppHandler(new ExecuteJobHandler()); AppHandlerManager.RegisterAppHandler(new StepByStepTaskHandler()); AppHandlerManager.RegisterAppHandler(new UploadTempFileHandler()); AppHandlerManager.RegisterAppHandler(new RegValidateHandler()); AppHandlerManager.RegisterAppHandler(new ChatMessageHandler()); AppHandlerManager.RegisterAppHandler(new AvatarHandler()); AppHandlerManager.RegisterAppHandler(new TempDataHandler()); #if !Passport AppHandlerManager.RegisterAppHandler(new Js_EmoticonHandler()); AppHandlerManager.RegisterAppHandler(new NotifyHandler()); AppHandlerManager.RegisterAppHandler(new DoingHandler()); AppHandlerManager.RegisterAppHandler(new ChangeSkinHandler()); AppHandlerManager.RegisterAppHandler(new OnlineInfoHandler()); AppHandlerManager.RegisterAppHandler(new PostAuthorInfoHandler()); //AppHandlerManager.RegisterAppHandler(new AttachmentHandler()); #endif #endregion #region 注册积分动作规则 PointActionManager.RegisterPointActionType(UserPointAction.Instance); PointActionManager.RegisterPointActionType(InvitePointAction.Instance); #if !Passport PointActionManager.RegisterPointActionType(SharePointAction.Instance); PointActionManager.RegisterPointActionType(BlogPointAction.Instance); //PointActionManager.RegisterPointActionType(PointShowPointAction.Instance); PointActionManager.RegisterPointActionType(CommentPointAction.Instance); PointActionManager.RegisterPointActionType(AlbumPointAction.Instance); PointActionManager.RegisterPointActionType(DoingPointAction.Instance); PointActionManager.RegisterPointActionType(ForumPointAction.Instance); #endif #endregion #region 注册验证码样式 ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style1()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style2()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style3()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style4()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style5()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style6()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style7()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style8()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style9()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style10()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style11()); ValidateCodeManager.RegisterValidateCodeType(new ValidateCode_Style12()); #endregion #region 注册验证码动作 ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("注册", "Register", false)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("登录", "Login", false)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("管理员登陆", "ManageLogin", false)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("找回密码", "recoverpassword", false)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表分享", "CreateShare", true)); //ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表收藏", "CreateCollection", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表日志", "CreateBlogArticle", true)); //ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表记录", "CreateDoing", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表评论", "CreateComment", true)); //论坛--- ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("发表主题", "CreateTopic", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("回复主题", "ReplyTopic", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("参与投票", "Vote", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("登陆带密码版块", "SignInForum", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("加好友", "AddFriend", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("对话", "SendMessage", true)); ValidateCodeManager.RegisterValidateCodeAction(new ValidateCodeAction("打招呼", "Hail", true)); #endregion #region 注册XCmd XCmdManager.RegisterXCmd(new DeleteFileCmd()); XCmdManager.RegisterXCmd(new ResetVarsCacheCmd()); XCmdManager.RegisterXCmd(new ResetUserCacheCmd()); XCmdManager.RegisterXCmd(new RecodeTodayPostsCmd()); #if !Passport XCmdManager.RegisterXCmd(new ResetAuthUserCacheCmd()); XCmdManager.RegisterXCmd(new ResetAlbumCacheCmd()); XCmdManager.RegisterXCmd(new ResetDenouncingCacheCmd()); XCmdManager.RegisterXCmd(new ResetFeedCommentInfoCmd()); #endif #endregion #if !Passport #region 注册 PermissionSetWithNode SettingManager.RegisterPermissionWithNode(new ForumPermissionSetNode().TypeName, new ForumPermissionSet()); SettingManager.RegisterPermissionWithNode(new ManageForumPermissionSetNode().TypeName, new ManageForumPermissionSet()); #endregion #region 注册UploadAction FileManager.RegisterUploadAction(new UploadAttachmentAction()); FileManager.RegisterUploadAction(new UploadAlbumPhotoAction()); FileManager.RegisterUploadAction(new UploadDiskFileAction()); #endregion #region 注册 IShareProvider ProviderManager.Add <IShareProvider>(new ShareBlogArticleProvider()); ProviderManager.Add <IShareProvider>(new ShareAlbumProvider()); ProviderManager.Add <IShareProvider>(new SharePhotoProvider()); ProviderManager.Add <IShareProvider>(new ShareUserProvider()); ProviderManager.Add <IShareProvider>(new ShareThreadProvider()); #endregion #endif #region 取数据库时间和时区作为当前时间和时区,避免web和数据库时间不同步 SetTimeAsDatabase(); #endregion #region 注册计划任务 JobManager.RegisterJob(new BeforeRequestInDay0AM()); JobManager.RegisterJob(new BeforeRequestIn5M()); JobManager.RegisterJob(new AfterRequestIn5M()); JobManager.RegisterJob(new AfterRequestIn3H()); JobManager.RegisterJob(new AfterRequestInDay3AM()); JobManager.RegisterJob(new ClearNotifyJob()); JobManager.RegisterJob(new ClearChatMessageJob()); JobManager.RegisterJob(new ClearPointLogJob()); #if !Passport JobManager.RegisterJob(new UpdateThreadViewsJob()); JobManager.RegisterJob(new SaveOnlineUserJob()); JobManager.RegisterJob(new DeleteFeedJob()); JobManager.RegisterJob(new DeletePropLogJob()); JobManager.RegisterJob(new DeleteOperationLogJob()); JobManager.RegisterJob(new BaiduPageOpJop()); #endif //在所有计划任务注册完之后 启动线程 JobManager.StartJobThread(); #endregion #region 初始化PASSPORT指令引擎 if (AllSettings.Current.PassportServerSettings.EnablePassportService) { PassportBO.StartInstructEngine(); } #endregion }