public static void Init(AspApplicationHost host, AspRequestBroker reqBroker) { AppHost = host; ReqBroker = reqBroker; string[] fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?efault.aspx"); if ((fileSystemEntries == null) || (fileSystemEntries.Length < 1)) { fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?ndex.aspx"); } if ((fileSystemEntries == null) || (fileSystemEntries.Length < 1)) { fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?efault.cshtml"); } if ((fileSystemEntries == null) || (fileSystemEntries.Length < 1)) { fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?ndex.cshtml"); } if ((fileSystemEntries == null) || (fileSystemEntries.Length < 1)) { fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?ndex.html"); } if ((fileSystemEntries == null) || (fileSystemEntries.Length < 1)) { fileSystemEntries = Directory.GetFileSystemEntries(AppHost.Path, "?ndex.htm"); } if ((fileSystemEntries != null) && (fileSystemEntries.Length > 0)) { _defaultDoc = Path.GetFileName(fileSystemEntries[0]); } }
private static void CreateAspApplicationHost() { //创建并配置用于承载 ASP.NET 的应用程序域。 _appHost = (AspApplicationHost)ApplicationHost.CreateApplicationHost(typeof(AspApplicationHost), "/", _pPath); _appHost.SetRequestBroker(_broker); //请求执行委托 _appFunc = new AppFunc(_appHost.Process); }
/// <summary> /// 卸载 /// </summary> private static void AspUnload() { _aspunloading = true; Console.WriteLine(" * Asp Applicaton unload....."); _appHost = null; _appFunc = null; if (_tasks.Count > 0) { foreach (ReqInfo info in _tasks.Values) { info.RequestWorkTask.SetCanceled(); } _tasks.Clear(); } _aspunloading = false; }