无法在winxp机器上运行netsh命令

本文关键字:运行 netsh 命令 机器 winxp | 更新日期: 2023-09-27 18:05:46

我想用以下代码编程地将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 7, win servers8机器上工作完美,但当涉及到Win xp时,它开始在CMD中抛出错误:The following command was not found http add urlacl url=https://127.0.0.1:8083 user=Everyone

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

在这种情况下我该怎么做?

无法在winxp机器上运行netsh命令

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

如果您运行的是Windows Server 2003或Windows XP,请使用HttpCfg.exe工具。在Windows Server 2003中安装了此工具。对于Windows XP,您可以在Windows XP Service Pack中下载该工具2支持工具。有关更多信息,请参见httpfg概述。的的语法Httpcfg.exe工具。