Search code examples
visual-studiocertificatewebdeploy

WebDeploy Publish: The remote certificate goes invalid after a few time... *despite* of accepting it repeatedly


Context

I am using VS 2019 WebDeploy publish. I do know the use case with not trusted server certificate, So I use the [Validate Connection] (see exhibit below) button which solves the issue, but only for a few times, or few minutes ahead... After that I got back the Web Publish Error.

Note: Interestingly when I am clicking the [Validate Connection] it never ask me to trust, instead just marks with the green checkmark withing 1-2 seconds. Maybe a few month ago it asked, but since then nothing...

So after getting the green checkmark, I can successfully publish, but a few times, or few minutes, after that I am getting back the certification error:

Connected to the remote computer ("myserver.westeurope.cloudapp.azure.com") using the specified process ("Web Management Service"), but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_CERTIFICATE_VALIDATION_FAILED. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure. Publish failed to deploy.

Question

What to do to permanently trust that certificate?

Exhibit

enter image description here


Solution

  • it seems it was the line

    <TimeStampOfAssociatedLegacyPublishXmlFile />
    

    in the publish.xml.user hidden file.