1

我想以Reserve the port编程port 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和machine 中运行良好7,但是当它开始抛出错误时: win servers8Win xpCMDThe following command was not found http add urlacl url=https://127.0.0.1:8083 user=Everyone

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

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

4

1 回答 1

4

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

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

于 2013-03-26T07:00:50.407 回答