public static void SetPath(this WebAppSetting appSetting, WebAppXml xml) { string resolveStartPath = AppUtil.ResolveUrl(appSetting.StartupPath); appSetting.LogOnPath = AppUtil.ResolveUrl(xml.Application.Url.LogOnPath); if (string.IsNullOrEmpty(appSetting.LogOnPath)) { appSetting.LogOnPath = resolveStartPath; } appSetting.HomePath = AppUtil.ResolveUrl(xml.Application.Url.HomePath); if (string.IsNullOrEmpty(appSetting.HomePath)) { appSetting.HomePath = resolveStartPath; } appSetting.MainPath = AppUtil.ResolveUrl(xml.Application.Url.MainPath); if (xml.Upload != null) { //if (!string.IsNullOrEmpty(fUploadVirtualPath)) // fUploadVirtualPath = VirtualPathUtility.AppendTrailingSlash(fUploadVirtualPath); //if (!string.IsNullOrEmpty(fUploadTempVirtualPath)) // fUploadTempVirtualPath = VirtualPathUtility.AppendTrailingSlash(fUploadTempVirtualPath); } // 假处理,以后需要考虑解决方案 appSetting.AppVirtualPath = "/"; //AppVirtualPath = HttpRuntime.AppDomainAppVirtualPath; //if (string.IsNullOrEmpty(AppVirtualPath)) // AppVirtualPath = "/"; //AppVirtualPath = VirtualPathUtility.AppendTrailingSlash(AppVirtualPath); }
protected override void ReadConfig(BaseAppSetting appSetting) { WebAppSetting webSetting = appSetting.Convert <WebAppSetting>(); string fileName = Path.Combine(appSetting.XmlPath, webSetting.ConfigFile); if (File.Exists(fileName)) { Config.ReadXmlFromFile(fileName); } }
//internal void InitialIndexer() //{ // fExceptionIndexer = new ExceptionIndexer(); //} //internal string GetExceptionLogName(Exception ex) //{ // string fileName = string.Format(ObjectUtil.SysCulture, "{0}_{1}.xml", // ex.GetType().Name, fExceptionIndexer.NextIndex()); // return Path.Combine(BaseAppSetting.Current.ErrorPath, fileName); //} protected override void ReadDefaultConfig(BaseAppSetting appSetting) { WebAppSetting webSetting = appSetting.Convert <WebAppSetting>(); string fileName = Path.Combine(appSetting.XmlPath, webSetting.DefaultValueFile); if (File.Exists(fileName)) { WebDefaultValue.ReadXmlFromFile(fileName); } else { WebDefaultValue.OnReadObject(); } }
public static void Config(this WebAppSetting setting, WebDefaultXmlConfig extXml) { WebConfigItem defaultConfig = extXml?.WebConfig; setting.DefaultPageMaker = defaultConfig?.DefaultPageMaker ?? new SourceOutputPageMakerConfig(); setting.DefaultRedirector = defaultConfig?.DefaultRedirector ?? new OutputRedirectorConfig(); setting.DefaultPostCreator = defaultConfig?.DefaultPostObjectCreator ?? new JsonPostDataSetCreatorConfig(); setting.ReadSettings = defaultConfig?.ReadSettings ?? ReadSettings.Default; setting.WriteSettings = defaultConfig?.WriteSettings ?? WriteSettings.Default; //ExceptionHandlerConfigItem exConfig = extXml.ExceptionHandler; //if (exConfig != null) //{ // //ErrorPageHandler = exConfig.ErrorPageException; // //ErrorOpeartionHandler = exConfig.ErrorOperationException; // //ReLogOnHandler = exConfig.ReLogonException; // //ToolkitHandler = exConfig.ToolkitException; // //ExceptionHandler = exConfig.Exception; //} //var tempHandleConfig = new PageMakerExceptionHandlerConfig() //{ // PageMaker = new TempPageMakerConfig(ExceptionPageMaker.Instance) //}; //if (ErrorPageHandler == null) // ErrorPageHandler = tempHandleConfig; //if (ErrorOpeartionHandler == null) //{ // ErrorOpeartionHandler = tempHandleConfig; //} //if (ReLogOnHandler == null) // ReLogOnHandler = new ReLogonExceptionHandlerConfig(); //if (ToolkitHandler == null) // ToolkitHandler = tempHandleConfig; //if (ExceptionHandler == null) // ExceptionHandler = new PageMakerExceptionHandlerConfig() // { // Log = true, // PageMaker = new TempPageMakerConfig(ExceptionPageMaker.Instance) // }; }
//private string fUploadVirtualPath; internal WebAppSetting(string basePath, WebAppXml xml) { fDictionary = new Dictionary <string, DbContextConfig>(); SolutionPath = xml.Application.Path; if (!Path.IsPathRooted(SolutionPath)) { SolutionPath = Path.GetFullPath(Path.Combine(basePath, SolutionPath)); } AppPath = xml.Application.AppPath; if (string.IsNullOrEmpty(AppPath)) { AppPath = "web/bin"; } AppPath = Path.GetFullPath(Path.Combine(SolutionPath, AppPath)); PlugInPath = xml.Application.PlugInPath; if (string.IsNullOrEmpty(PlugInPath)) { PlugInPath = "Modules"; } PlugInPath = Path.GetFullPath(Path.Combine(AppPath, PlugInPath)); if (!string.IsNullOrEmpty(xml.Application.ActionResultName)) { ActionResultName = xml.Application.ActionResultName; } EnableCrossDomain = xml.Application.EnableCrossDomain; XmlPath = Path.Combine(SolutionPath, "Xml"); ErrorPath = Path.Combine(SolutionPath, "Error"); IsDebug = xml.Debug.Debug; ShowException = xml.Debug.ShowException; fQueryStringName = xml.Debug.XmlQueryString; fQueryStringValue = xml.Debug.XmlValue; fMetaDataValue = xml.Debug.MetaDataValue; fJsonValue = xml.Debug.JsonValue; fExcelValue = xml.Debug.ExcelValue; UseCache = xml.Application.UseCache; Culture = xml.Application.Culture; UseWorkThread = xml.Application.UseWorkThread; CacheTime = xml.Application.CacheTime; TimingInterval = xml.Application.TimingInterval; CommandTimeout = xml.Application.CommandTimeout; DefaultValueFile = xml.Application.DefaultValueFile; ConfigFile = xml.Application.ConfigFile; AppRightBuilder = xml.Application.AppRightBuilder; SecretKey = xml.SecretKey; StartupPath = xml.Application.Url.StartupPath; //string resolveStartPath = WebUtil.ResolveUrl(StartupPath); //LogOnPath = WebUtil.ResolveUrl(xml.Application.Url.LogOnPath); //if (string.IsNullOrEmpty(LogOnPath)) // LogOnPath = resolveStartPath; //HomePath = WebUtil.ResolveUrl(xml.Application.Url.HomePath); //if (string.IsNullOrEmpty(HomePath)) // HomePath = resolveStartPath; //MainPath = WebUtil.ResolveUrl(xml.Application.Url.MainPath); string errorPage = xml.Application.Url.ErrorPage; if (!string.IsNullOrEmpty(errorPage)) { ErrorPagePath = Path.GetFullPath(Path.Combine(AppPath, "..", errorPage)); ErrorPageUri = new Uri(errorPage, UriKind.Relative); } AppInfoConfigItem appInfo = xml.Application.Info; if (appInfo != null) { AppFullName = appInfo.FullName.ToString(); AppShortName = appInfo.ShortName.ToString(); AppDescription = appInfo.Description == null ? string.Empty : appInfo.Description.ToString(); } else { AppFullName = AppShortName = AppDescription = string.Empty; } if (xml.IO != null) { InputGZip = xml.IO.InputGZip; InputEncrypt = xml.IO.InputEncrypt; OutputGZip = xml.IO.OutputGZip; OutputEncrypt = xml.IO.OutputEncrypt; } if (xml.Upload != null) { string baseUploadPath = SolutionPath; fUploadTempPath = Path.Combine(baseUploadPath, xml.Upload.TempPath); //fUploadPath = Path.Combine(baseUploadPath, xml.Upload.Path); //if (!Directory.Exists(fUploadPath)) // Directory.CreateDirectory(fUploadPath); if (!Directory.Exists(fUploadTempPath)) { Directory.CreateDirectory(fUploadTempPath); } //fUploadVirtualPath = xml.Upload.VirtualPath; //if (!string.IsNullOrEmpty(fUploadVirtualPath)) // fUploadVirtualPath = VirtualPathUtility.AppendTrailingSlash(fUploadVirtualPath); fUploadTempVirtualPath = xml.Upload.TempVirtualPath; //if (!string.IsNullOrEmpty(fUploadTempVirtualPath)) // fUploadTempVirtualPath = VirtualPathUtility.AppendTrailingSlash(fUploadTempVirtualPath); } ConfigDatabase(xml); Current = this; fCurrent = this; if (xml.Hosts != null) { foreach (var item in xml.Hosts) { AddHost(item.Key, item.Value); } } InitialIndexer(); // 假处理,以后需要考虑解决方案 //AppVirtualPath = "/"; //AppVirtualPath = HttpRuntime.AppDomainAppVirtualPath; //if (string.IsNullOrEmpty(AppVirtualPath)) // AppVirtualPath = "/"; //AppVirtualPath = VirtualPathUtility.AppendTrailingSlash(AppVirtualPath); }