Visual studio 2015 exception: Connected to the…. but could not verify the server’s certificate. If you trust the server, connect again and allow untrusted certificates

Since last some days, I have observed that some people are seeing some errors while publishing the MVC6 project from Visual Studio 2015 so, I decided to write a post with the solution.

So generally people get below error while publishing:

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.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s