Publishing from Visual Studio 2015 - allow untrusted certificates

前端 未结 9 1342
挽巷
挽巷 2020-12-12 20:08

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

相关标签:
9条回答
  • 2020-12-12 20:46

    Another solution as well

    I had this same issue when deploying Azure Web Jobs in VS2019. Look at my answer here for more details.

    0 讨论(0)
  • 2020-12-12 20:49

    For dot net core 1.0 you have to add the tag

     <AllowUntrustedCertificate>True</AllowUntrustedCertificate>
    

    to publishprofiles in your .pubxml file

    0 讨论(0)
  • 2020-12-12 20:50

    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.

    0 讨论(0)
  • 2020-12-12 20:54

    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.

    1. Open the publish profile file (.pubxml) inside /Properties/PublishProfiles in a text editor
    2. Inside the <PropertyGroup> element, set AllowUntrustedCertificate to True (<AllowUntrustedCertificate>True</AllowUntrustedCertificate>) or add it if it doesn't exist
    3. Set UsePowerShell to False (<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.

    0 讨论(0)
  • 2020-12-12 20:54

    After importing or creating profile click configure and then validate connection. Enter password and finish the setup. Now deploy.

    0 讨论(0)
  • 2020-12-12 21:01

    For dotnet 3.1.0 in VS 2019 just go "Edit" profile -> Validate Connection -> Accept the certificate and its done

    0 讨论(0)
提交回复
热议问题