Publishing from Visual Studio 2015 - allow untrusted certificates

前端 未结 9 1343
挽巷
挽巷 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 21:02

    Update

    Just a little observation, when deploying a .net core app on VS2015 or VS2017 community, to a remote IIS server please use this

    <UsePowerShell>True</UsePowerShell> 
    

    not

    <UsePowerShell>False</UsePowerShell>
    

    Discovered that deployment was completing as successful but no files were copied to server until I changed the tag to true.

    I hope this helps someone.

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

    I had <UsePowerShell>True</UsePowerShell> but it was still failing with the cert error.

    • I re-entered my password in the settings dialog and it still failed
    • Once I clicked on Validate Connection it started working.

    Note

    • VS 2017 (15.2)
    • My password recently changed
    • As a test, entered the wrong password and I got the cert error so the cert error is not just about an untrusted cert apparently
    0 讨论(0)
  • 2020-12-12 21:05

    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:

    <WebPublishMethod>MSDeploy</WebPublishMethod>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish>https://some.site.com:443/</SiteUrlToLaunchAfterPublish>
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <PublishFramework>netcoreapp1.1</PublishFramework>
    <ProjectGuid>eecf975e-f2e6-440f-bfd6-a0a63c25e3c3</ProjectGuid>
    <MSDeployServiceURL>https://url.toourserver.com:8172/msdeploy.axd?site=some.site.com</MSDeployServiceURL>
    <DeployIisAppPath>some.site.com</DeployIisAppPath>
    <RemoteSitePhysicalPath />
    <SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
    <MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
    <EnableMSDeployBackup>True</EnableMSDeployBackup>
    <UserName>IISUserName</UserName>    
    <AllowUntrustedCertificate>True</AllowUntrustedCertificate>    
    <_SavePWD>True</_SavePWD>
    

    <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.

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