【问题标题】:Permission set for newly created IIS AppPool Identity新创建的 IIS AppPool 标识的权限集
【发布时间】:2012-12-14 16:41:07
【问题描述】:

我需要为创建的 IIS 应用程序池设置日志文件夹的权限。设置权限的代码:

<CreateFolder Directory="SiteLogsFolder">
    <util:PermissionEx User="Everyone" Read="yes" GenericRead="yes"/>
    <util:PermissionEx User="[IisSiteUser]" GenericRead="yes" GenericWrite="yes" GenericExecute="yes" Delete="yes" DeleteChild="yes"/>
</CreateFolder>

<CustomAction Id="SetIis6SiteUser" Property="IisSiteUser" Value="NT AUTHORITY\NetworkService"/>
<CustomAction Id="SetIis7SiteUser" Property="IisSiteUser" Value="IIS AppPool\[SITE_APP_POOL]"/>

<InstallExecuteSequence>
  <Custom Action="SetIis7SiteUser" Before="InstallInitialize">IISMAJORVERSION>="#7"</Custom>
  <Custom Action="SetIis6SiteUser" Before="InstallInitialize">IISMAJORVERSION="#6"</Custom>
</InstallExecuteSequence>

这适用于 Windows Server 2003 上的 IIS 6,但适用于 Windows Server 2008 上的 IIS 7.5。我收到错误消息:

ExecSecureObjects:  Error 0x80070534: failed to get sid for account: IIS AppPool\MyAppPool

调查详情:

  • 我也尝试了“IIS APPPOOL”域 - 结果相同。
  • 还尝试设置 PermissionEx 元素的 Domain 和 User 属性,而不是将它们合并到 User 属性中。同样的错误。
  • 在 PermissionEx 中使用活动目录帐户可以正常工作。设置后,活动目录帐户也可以与 IIS 站点池正常工作。
  • 如果我尝试为另一个 AppPool 设置权限(不是由我的安装程序创建的,例如 IIS AppPool\DefaultAppPool),一切正常。仅当我为安装程序创建的 AppPool 设置权限时才会出现此问题。
  • 我检查了 ConfigureIIs、SchedSecureObjects 和 ExecSecureObjects 的顺序,并尝试强制 ConfigureIIs 在其他两个之前执行(推荐 in this thread)。不幸的是,这也没有帮助。

【问题讨论】:

  • 同样的问题,正在寻找解决方案。

标签: iis-7 permissions wix


【解决方案1】:

我在将 WIX 项目构建为 x86 时遇到了这个问题。我通过在 ConfigureIIs 之前安排 SchedSecureObjects 和 ExecSecureObjects 解决了这个问题。

<Custom Action="SchedSecureObjects" After="ConfigureIIs" />
<Custom Action="ExecSecureObjects" After="ConfigureIIs" />

当我开始将项目构建为 x64 时,问题再次出现。这次我也必须在 ConfigureIIs 之前安排 64 位操作。

<Custom Action="SchedSecureObjects_x64" After="ConfigureIIs" />
<Custom Action="ExecSecureObjects_64" After="ConfigureIIs" />
<Custom Action="SchedSecureObjects" After="ConfigureIIs" />
<Custom Action="ExecSecureObjects" After="ConfigureIIs" />

【讨论】:

    【解决方案2】:

    在 Server 2012 上进行测试后,我确认在帐户可用之前可能会有延迟。使用以下脚本,我在大约 30 次尝试中的 3 次中重现失败。似乎我们需要在创建应用程序池和查找 SID 之间进行延迟。在我的测试中,它从不超过 1 秒。

    param ($id)
    if (!$id) {write-host "specify an id"; return}
    c:\windows\system32\inetsrv\appcmd add apppool /name:$id /managedRuntimeVersion:"v4.0" /managedPipelineMode:"Integrated"
    $objUser = New-Object System.Security.Principal.NTAccount("IIS APPPOOL\$id")
    $sid=""
    while (!$sid)
    {
      $sid = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
      if (!$sid) {write-host "$id not found"} else {$sid}
      sleep 1
    }
    

    【讨论】:

    • 在编写脚本时这不是一个坏主意。但是在创建用户身份和使用它之间准确地暂停 Windows 安装程序并不容易 - 它按照内部定义的顺序执行所有操作。可能可以创建延迟自定义操作,但该解决方案会非常尴尬
    猜你喜欢
    • 2013-05-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-24
    • 2016-06-15
    • 1970-01-01
    • 2020-07-30
    相关资源
    最近更新 更多