I am publishing my ASP.NET 5 MVC6 project from Visual Studio 2015. I have imported publish profile from my server. Connection validates successfully, however when I publish my project I have the following error:
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.
There is no option to allow untrusted certificates in publishing settings.
For me, the solution took 4 lines in the publish profile xml.
The
UseMsDeployExe
changes the error to ignore the certificate, but not authenticate the user, hence the need for the user and pass (of the machine you're deploying to)No changes were needed in the powershell script.
I had
<UsePowerShell>True</UsePowerShell>
but it was still failing with the cert error.Note
The option to allow untrusted certificates is not yet supported in the current tooling. Hopefully, this gets updated very soon. You can, however, set it manually.
.pubxml
) inside /Properties/PublishProfiles in a text editor<PropertyGroup>
element, set AllowUntrustedCertificate to True (<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
) or add it if it doesn't exist<UsePowerShell>False</UsePowerShell>
).At this time of writing, the generated powershell script disregards theAllowUntrustedCertificate
property which is probably a bug, hence, the need to set it toFalse
.You can get powershell to work if you update the module version in the
.ps1
file.As a side note, you can also get around this problem by "trusting" the server's certificate locally.
Yet another solution
I created publish settings on the remote IIS and imported them in Visual Studio 2017 (15.2). After that I changed the URL to specify the sitename as the IIS-user only has access to the specific site (thanks to this answer on SO). I've entered the credentials via the UI and there is no need to store the password in the profile.
My profile looks like:
<AllowUntrustedCertificate>
was needed as the self signed certificate is not trusted on my machine.With this profile a backup is made according to the settings in IIS, the site is updated and opened in my browser when the process is finished :-)
Although all the other answers here also made it work, I thought it would be nice to share this way as it involves only a few changes (AllowUntrustedCertificate) and no storage of plain passwords.
For dot net core 1.0 you have to add the tag
to publishprofiles in your .pubxml file
After importing or creating profile click configure and then validate connection. Enter password and finish the setup. Now deploy.