本文介绍了使用持续部署在 IIS 服务器中自动部署 ASP.Net MVC 网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Visual Studio Team Services Build 部署 Web 应用程序.我正在使用 Visual Studio Build 任务来构建项目.然后,使用命令行任务执行生成的 release.deploy.cmd 部署到 IIS 服务器中.在执行时,我遇到了以下问题:

E"C:Program FilesIISMicrosoft Web Deploy V3msdeploy.exe" -source:package='C:CIDeploywebapp.zip' -dest:auto,includeAcls="False" -verb:同步 -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"C:CIDeploywebapp.SetParameters.xml"

2016-12-02T10:29:18.2576272Z 警告:BACKUP_FAILED - 由于未知原因失败而跳过备份.┬á有关更多信息,请联系您的服务器管理员.2016-12-02T10:29:18.2586324Z 跳过备份,因为由于以下错误System.UnauthorizedAccessException: Filename: redirection.config

"而失败

错误:读取 IIS 配置文件MACHINE/REDIRECTION"时出错.执行操作的身份是TASKAGENT5-0017uildguest".

2016-12-02T10:29:18.4396280Z 错误:文件名:?C:Windowssystem32inetsrvconfigedirection.config2016-12-02T10:29:18.4396280Z 错误:由于权限不足,无法读取配置文件

提前致谢.

解决方案

使用 WinRM-IIS Web 应用部署任务/步骤部署您的 Web 项目.

  1. 安装
  2. 添加 Windows 机器文件复制步骤/任务
  3. 添加 WinRM- IIS Web 应用程序管理步骤/任务
  4. 添加 WinRM-IIS Web 应用部署步骤/任务

顺便说一句:你可以把部署任务放在发布中(参考那篇文章)

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 generated release.deploy.cmd to deploy in IIS server. On executing, I faced the below issue:

E"C:Program FilesIISMicrosoft Web Deploy V3msdeploy.exe" -source:package='C:CIDeploywebapp.zip' -dest:auto,includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"C:CIDeploywebapp.SetParameters.xml"

2016-12-02T10:29:18.2576272Z Warning: BACKUP_FAILED - Skipping backup because it failed due to an unknown reason. For more information, contact your server administrator.2016-12-02T10:29:18.2586324Z Skipping backup because it failed due to the following error 'System.UnauthorizedAccessException: Filename: redirection.config

Error: An error occurred when reading the IIS Configuration File 'MACHINE/REDIRECTION'. The identity performing the operation was 'TASKAGENT5-0017uildguest'.

2016-12-02T10:29:18.4396280Z Error: Filename: ?C:Windowssystem32inetsrvconfigedirection.config2016-12-02T10:29:18.4396280Z Error: Cannot read configuration file due to insufficient permissions

Thanks in advance.

解决方案

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)

这篇关于使用持续部署在 IIS 服务器中自动部署 ASP.Net MVC 网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 06:31