How to Fix Could Not Verify Server Certificate WebDeploy

We have observed that few of our clients and many users experience this error when publishing Asp.net core from Visual Studio 2019. So, we will write solution about how to fix this error message. The following is the error message:

ERROR_CERTIFICATE_VALIDATION_FAILED

Connected to the remote computer (“XXXXXXXXX”) 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.

To solve this, we need some option to allow untrusted certificates in publishing settings.

Solution:

Currently, there are not any options available to allow untrusted certificates so we need to do some tweaks which are as below:

  • Please search for Publish profile file within  /Properties/PublishProfiles folders and open it
  • set AllowUntrustedCertificate to True (<AllowUntrustedCertificate>True</AllowUntrustedCertificate>) inside the <PropertyGroup> element
  • Add below lines in the same file if tags are not available
<UseMsDeployExe>true</UseMsDeployExe>
<UserName>myuser</UserName>
<Password>mypass</Password>

That is it. It should not throw the exception now.

Hope it helps.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *