Question

I want to Reserve the port and port binding with programmatically with the following code:

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;
    }}

For port Binding: Replace the parameter of startInfo.Arguments with @"/c netsh http add sslcert ipport=127.0.0.1:8083 certhash=df03c4b0b32f3302a3b70abe6b5dfd864d0986a5 appid={00112233-4455-6677-8899-CCBBCCDDEEFF} clientcertnegotiation=enable";

Above commands are working perfectly in win 7 , win servers and 8 machine but when it comes to Win xp It started to throw an error in CMD: The following command was not found http add urlacl url=https://127.0.0.1:8083 user=Everyone

I check the certificate which is successfully imported in mmc in all machine.

What should i do in such cases?

Was it helpful?

Solution

Acording to MSDN you can't use netsh for that with xp.

If you are running Windows Server 2003 or Windows XP, use the HttpCfg.exe tool. With Windows Server 2003 this tool is installed. With Windows XP, you can download the tool at Windows XP Service Pack 2 Support Tools. For more information, see Httpcfg Overview. The Windows Support Tools documentation explains the syntax for the Httpcfg.exe tool.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top