Automated Deployement of ASP.Net MVC Website In IIS server with a Continuous Deployment

后端 未结 2 1414
夕颜
夕颜 2021-01-26 05:46

I\'m trying to deploy a web application from Visual Studio Team Services Build. I\'m using Visual Studio Build task to build the project. Then, use command line task to execute

相关标签:
2条回答
  • 2021-01-26 06:16

    Using WinRM-IIS Web App Deployment task/step to deploy your web project.

    1. Install IIS Web App Deployment Using WinRM extension
    2. Add WinRM-IIS Web App Management step/task to your build/release definition
    3. Specify necessary arguments (e.g. Admin Login, Password)

    On the other hand, there are others extension in marketplace that can deploy web project.

    Update:

    Detail steps:

    1. Download or create ConfigureWinRM.ps1 file (source code)
    2. Go to target server (IIS)
    3. Start Windows PowerShell as Administrator
    4. Go to (CD command) the path that contains ConfigureWinRM.ps1 file
    5. Run .\ConfigureWinRM.ps1 [machine name with domain] https
    6. Open Microsoft Management Console (MMC) (Type mmc in Run command (win+R))
    7. File=>Add/Remove Snap-in=>Select Certificates=>Add=>Ok
    8. Expand Certificate (Local Computer)=>Personal=>Certificates
    9. Select the certificate file according to the Issued to (step 5)
    10. Right click it=>All task=>Export to export certificate file
    11. Copy exported file to your build server
    12. Double click that file=>Install Certificate=>Local Machine=>Place all certificates in following store=>Trusted Root Certification Authorities
    13. Add Visual Studio Build step/task (MSBuild argument: /p:SkipInvalidConfigurations=true /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageLocation="$(build.artifactstagingdirectory)\WebGeneralDemo.zip")
    14. Add Windows Machine File Copy step/task
    15. Add WinRM- IIS Web App Management step/task
    16. Add WinRM-IIS Web App Deployment step/task

    BTW: you can put deploy task in release (refer to that article)

    0 讨论(0)
  • 2021-01-26 06:28

    You cannot deploy locally on a Hosted Agent: you must deploy to another machine. The easiest way is to use VSTS Resource Management and and Agent running on the target machine with administrative privileges (I would suggest to run it non-admin and grant in IIS permission to the user to deploy).

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