如何解决不受信任的证书错误?(TFS2013 构建并部署到 IIS)

How can resolve Untrusted certificates Error ?( TFS2013 Build and deploy to IIS )

我在 tfs2013.when 上创建了一个构建定义 我对我的构建定义进行了排队 我收到有关不受信任的证书的错误。

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets (4270): Web deployment task failed. (Connected to the remote computer ("developertest") 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.

我查看了帮助 link,它有 3 种解决方法

第一种和第三种方法我不知道怎么做 在第二种方式中,我无法在 vs2013 发布对话框中找到 Allow untrusted

我将 /p:AllowUntrustedCertificate=true 添加到 MsBuild arguments.and 它已解决

谢谢M.Azad,它解决了我的问题。 我试图在 .pubxml 文件中设置这些配置 True 错误的 但这并没有解决问题,而是在 msbuild.bat 文件中添加 /p:AllowUntrustedCertificate=true arugment 解决了。

msbuild.exe

的完整参数列表

C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe %ProjectPath% /fl /flp:logfile=%LogPath% /T:Build /p:DeployOnBuild=true /p:DeployTarget=MSDeployPublish /p:PublishProfile=%ProfilePath% /p:PublishDir="C:\wwroot" /p:AllowUntrustedCertificate=true /p:VisualStudioVersion=12.0

使用不受信任的证书发布到服务器

Add the <AllowUntrustedCertificate> property with a value of True to the publish profile: C:\Users\xxxx\source\repos\xxxx\xxxx\Properties\PublishProfiles\IISProfile.pubxml
    <PropertyGroup>
      <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
    </PropertyGroup>

https://docs.microsoft.com/en-us/aspnet/core/host-and-deploy/visual-studio-publish-profiles?view=aspnetcore-5.0#publish-to-a-server-using-an-untrusted-certificate