繁体   English   中英

无法在Win XP机器上运行netsh命令

[英]Not able to run netsh command in Win XP machine

我想使用以下代码以编程方式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 servers但是当涉及到Win xp它开始在CMD抛出一个错误: The following command was not found http add urlacl url=https://127.0.0.1:8083 user=Everyone

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

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

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

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

暂无
暂无

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

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