powershell - 发布 Web App 添加任务所需的代理配置

标签 powershell iis-8.5 azure-pipelines-release-task azure-devops-server-2019

要在 IIS 下创建目录并将 Web 应用程序添加到 IIS,我将此脚本放在 Azure DevOps 服务器部署组作业 Powershell 任务中:

New-Item -Path "C:\inetpub\wwwroot" -Name "MyNewApp" -ItemType "directory" `
C:\Windows\system32\inetsrv\appcmd.exe add app `
/site.name:"Default Web Site" `
/path:"/MyNewApp" `
/physicalPath:"C:\inetpub\wwwroot\MyNewApp"`
当此任务运行时,它会抛出一个错误:(为清楚起见,删除了时间戳)

APP object "Default Web Site/MyNewApp" changed

ERROR ( hresult:80090016, message:Failed to commit configuration changes.

Keyset does not exist )


在以我自己或服务帐户登录时从 Powershell 控制台执行上述代码后,将返回以下消息:

APP object "Default Web Site/MyNewApp" added

VDIR object "Default Web Site/MyNewApp" added


我可以在 IIS 管理器中确认目录和应用程序已创建。
我无法在控制台中重现该错误。只有当它作为 Release Agent 运行并通过 DevOps Server Web 界面启动时才会发生此错误。
我尝试了以下方法:
  • key 集问题 - https://support.microsoft.com/en-us/help/977754/keyset-does-not-exist-error-message-when-you-try-to-change-the-identit对于 本地服务和服务帐户。
  • 最多修改服务帐户在 C:\inetpub\wwwroot 上的权限
  • 将服务帐户添加到 IIS 管理器权限

  • 更新 1 :
    我确定“ key 集不存在”错误来自尝试使用 DefaultAppPool 应用程序池作为设置的一部分。此应用程序池未使用服务帐户设置,但仍设置为默认应用程序池标识。
    但是,在进行此更改后,我遇到了一个新错误:

    APP object "Default Web Site/MyNewApp" changed

    ERROR ( hresult:80070057, message:Failed to commit configuration changes.

    The parameter is incorrect. )

    ...

    Process 'appcmd.exe' exited with code '87'.


    非常感谢任何指导。
    更新 2 :
    我在 Microsoft 社区记录了一个当前正在查看的问题。你可以看到here .

    最佳答案

    关于powershell - 发布 Web App 添加任务所需的代理配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55542684/

    相关文章:

    powershell - 如何在 PowerShell v5 模块中导出类

    powershell - 如何修复 Windows 10 中 powershell 中的下载文件错误

    powershell - 从文本文件中读取特定文本

    performance - 为 php 5.6 激活 WinCache 和 OpCache 以提高性能?

    azure-devops - 在 Azure DevOps (VSTS) 中的发布阶段之间共享文件

    使用 powershell 解析/格式化字符串

    asp.net-mvc - 服务器上的等待时间只有在生产中才会很大

    ssl - 在 IIS 8.5 中设置具有多个绑定(bind)的 SSL 站点

    iis - 将parameters.xml 或setParams.xml 替换为Azure DevOps Release Pipeline 变量

    azure-devops - 无法在 Azure DevOps 中创建发布管道