iisdeploymentssl-certificatenetsh

SSL Certificate add failed, Error: 183, Cannot create a file when that file already exists


Below error prevents deployment of my web application on IIS.

Exact error msg:

2023-01-10T09:37:12.3948952Z ##[command]"netsh" http show sslcert ipport=0.0.0.0:460
2023-01-10T09:37:12.4640383Z ##[command]"netsh" http add sslcert ipport=0.0.0.0:460 certhash=*** appid={2f458-f070-403b-bb53-5e35ff05701} certstorename=MY
2023-01-10T09:37:12.4983107Z 
2023-01-10T09:37:12.4983504Z SSL Certificate add failed, Error: 183
2023-01-10T09:37:12.4988896Z Cannot create a file when that file already exists.


I tried as mentioned in few of stack overflow answers.

In Netsh, I tried deleting the old certificate if already bounded, but says deletion failed, and cant find file.

netsh>http delete sslcert ipport=0.0.0.0:460

SSL Certificate deletion failed, Error: 2
The system cannot find the file specified.

Would appreciate your help. Thanks.


Solution

  • About adding an SSL certificate, you can refer to netsh-http#add-sslcert and netsh-http#delete-sslcert. There are examples in the documentation for reference.

    "The system cannot find the file specified." means that there weren't certificates bound to these ports. You can Configure a Port with an SSL Certificate. You can also refer to this similar answer

    certhash=***. The certhash parameter specifies the thumbprint of the certificate. Retrieve the Thumbprint of a Certificate