简体   繁体   English

IIS重新启动(无法启动任何进程并调用iisreset)来自网站本身

[英]IIS Restart (cannot start any process and call iisreset) from the website itself

public static void RestartIIS()
{
    string path = Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\iisreset.exe";
    System.Diagnostics.ProcessStartInfo info = new System.Diagnostics.ProcessStartInfo(path);
    info.UseShellExecute = true;
    System.Diagnostics.Process.Start(info);
}

You'll need to have administrative permissions to do this; 您需要具有管理权限才能执行此操作; running IIS as administrator is absolutely not recommended! 绝对不建议以管理员身份运行IIS!

Rather, I'd suggest that instead of trying to administer the site from itself you work with one of the remote access / remote management tools. 相反,我建议您不要尝试从自身管理网站,而是使用其中一个远程访问/远程管理工具。 Something like the remote administration for IIS is basic but useable: http://learn.iis.net/page.aspx/158/remote-administration-for-iis-manager/ . 像IIS的远程管理一样基本但可用: http//learn.iis.net/page.aspx/158/remote-administration-for-iis-manager/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM