【问题标题】:Not able to run netsh command in Win XP machine无法在 Win XP 机器上运行 netsh 命令
【发布时间】:2013-03-26 06:38:35
【问题描述】:

我想以编程方式使用以下代码 Reserve the portport binding

private void PortReserve()
{
  try
   {
    System.Diagnostics.Process process = new System.Diagnostics.Process();
    System.Diagnostics.ProcessStartInfo startInfo = new           
    System.Diagnostics.ProcessStartInfo();
    startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal;
    startInfo.FileName = "cmd.exe";
    startInfo.UseShellExecute = true;
    startInfo.Arguments = @"/c netsh http add urlacl url=https://127.0.0.1:8083/ user=EVERYONE";
    process.StartInfo = startInfo;
    process.Start();

    }
    catch (Exception ex)
    {
      throw ex;
    }}

对于端口绑定: 将startInfo.Arguments的参数替换为@"/c netsh http add sslcert ipport=127.0.0.1:8083 certhash=df03c4b0b32f3302a3b70abe6b5dfd864d0986a5 appid={00112233-4455-6677-8899-CCBBCCDDEEFF} clientcertnegotiation=enable";

以上命令在 win 7win servers8 机器中运行良好,但是当涉及到 Win xp 它开始在 CMD 中抛出错误: The following command was not found http add urlacl url=https://127.0.0.1:8083 user=Everyone

我检查了mmc中所有machine中成功导入的证书。

遇到这种情况该怎么办?

【问题讨论】:

    标签: c# visual-studio-2010 cmd windows-xp netsh


    【解决方案1】:

    根据MSDN,您不能在 xp 中使用 netsh。

    如果您运行的是 Windows Server 2003 或 Windows XP,请使用 HttpCfg.exe 工具。在 Windows Server 2003 中安装了此工具。 对于 Windows XP,您可以从 Windows XP Service Pack 下载该工具 2 支持工具。有关详细信息,请参阅 Httpcfg 概述。这 Windows 支持工具文档解释了 Httpcfg.exe 工具。

    【讨论】:

      猜你喜欢
      • 2014-11-20
      • 2011-12-21
      • 2012-06-09
      • 2013-06-06
      • 1970-01-01
      • 2019-02-24
      • 2011-03-11
      • 2010-10-06
      • 1970-01-01
      相关资源
      最近更新 更多