sAppPoolName.ManagedRuntimeVersion v4.0 sm.ApplicationPoolsAppPoolName.ManagedPipelineMode ManagedPipelineMode.Classic //托管模式 Integrated 为集成 Classic 为经典 sm.CommitChanges endregion vdEntry.PropertiesAppPoolId.Value AppPoolName vdEntry.CommitChanges endregion //启动 aspnet_regiis.exe 程序 string fileName Environment.GetEnvironmentVariablewindir Microsoft.NETFrameworkv4.0.30319aspnet_regiis.exe ProcessStartInfo startInfo newProcessStartInfofileName //处理目录路径 string path vdEntry.Path.ToUpper int index path.IndexOfW3SVC path path.Remove0 index //启动 ASPnet_iis.exe 程序刷新脚本映射 startInfo.Arguments -s path startInfo.WindowStyle ProcessWindowStyle.Hidden startInfo.UseShellExecute false startInfo.CreateNoWindow true startInfo.RedirectStandardOutput true startInfo.RedirectStandardError true Process process new Process process.StartInfo startInfo process.Start process.WaitForExit string errors process.StandardError.ReadToEnd if errors string.Empty throw new Exceptionerrors string entPath String.FormatIIS://0/w3svc localhostpublic DirectoryEntry GetDirectoryEntrystring entPath DirectoryEntry ent new DirectoryEntryentPath return ent public class NewWebSiteInfo private string hostIP // 主机 IP private string portNum // 网站端口号 private string descOfWebSite // 网站表示。
一般为网站的网站名。
例如www.dns.com.cn private string commentOfWebSite// 网站注释。
一般也为网站的网站名。
private string webPath // 网站的主目录。
例如e: mp public NewWebSiteInfostring hostIP string portNum stringdescOfWebSite string commentOfWebSite string webPath this.hostIP hostIP this.portNum portNum this.descOfWebSite descOfWebSite this.commentOfWebSite commentOfWebSite this.webPath webPath public string BindString get return String.Format0:1:2 hostIPportNum descOfWebSite //网站标识(IP端口,主机头值) public string PortNum get return portNum public string CommentOfWebSite get return commentOfWebSite public string WebPath get return webPath 8:下面的代码是对文件夹权限进行设置,下面代码是创建 Everyone 并给予全部权限 /// /// 设置文件夹权限 处理给 EVERONE 赋予所有权限 /// ///文件夹路径 public void SetFileRole string FileAdd this.Context.Parametersinstalldir.ToString FileAdd FileAdd.RemoveFileAdd.LastIndexOf 1 DirectorySecurity fSec new DirectorySecurity fSec.AddAccessRulenewFileSystemAccessRuleEveryoneFileSystemRights.FullControlInheritanceFlags.ContainerInheritInheritanceFlags.ObjectInheritPropagationFlags.NoneAccessControlType.Allow System.IO.Directory.SetAccessControlFileAdd fSec
上一篇:
帝国cms采集图文教程(下)(2)
下一篇:
画一卷情长,念一世安好