Reputation: 278
I'm using VS2015 Update 1 attempting to one click publish a aspnet 5 vNext MVC site. The server I'm publishing to does not have a real certificate and therefore I get the error:
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error Code: ERROR_CERTIFICATE_VALIDATION_FAILED
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : More Information: Connected to the remote computer ("REDACTED") 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.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Microsoft.DNX.Publishing.targets(386,5): Error : Error: The remote certificate is invalid according to the validation procedure.
Per the (rather old) link I've found that I can easily get this to work by manually running the msbuild command and also passing the -allowUntrusted
switch. However I cannot find a UI dialog setting, XML tag in the *.pubxml
, nor a good place in the *publish.ps1
file to make this behavior work from within visual studio.
How can I make one click publish ignore my server's invalid certificate?
Upvotes: 3
Views: 1852
Reputation: 278
To the *One Click pub.xml
file
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
...
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
...
Upvotes: 5