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
Another solution as well
I had this same issue when deploying Azure Web Jobs in VS2019. Look at my answer here for more details.
For dot net core 1.0 you have to add the tag
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
to publishprofiles in your .pubxml file
For me, the solution took 4 lines in the publish profile xml.
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
<UseMsDeployExe>true</UseMsDeployExe>
<UserName>myuser</UserName>
<Password>mypass</Password>
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.
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 the AllowUntrustedCertificate
property which is probably a bug, hence, the need to set it to False
.
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.
After importing or creating profile click configure and then validate connection. Enter password and finish the setup. Now deploy.
For dotnet 3.1.0 in VS 2019 just go "Edit" profile -> Validate Connection -> Accept the certificate and its done