Iis 7 新创建的IIS应用池标识的权限集

Iis 7 新创建的IIS应用池标识的权限集,iis-7,permissions,wix,Iis 7,Permissions,Wix,我需要为创建的IIS应用程序池设置对日志文件夹的权限。用于设置权限的代码: <CreateFolder Directory="SiteLogsFolder"> <util:PermissionEx User="Everyone" Read="yes" GenericRead="yes"/> <util:PermissionEx User="[IisSiteUser]" GenericRead="yes" GenericWrite="yes" Gene

我需要为创建的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>
调查详情:

  • 我还尝试了“IIS应用池”域-相同的结果
  • 还尝试设置PermissionEx元素的域属性和用户属性,而不是在用户属性中合并它们。同样的错误
  • 在PermissionEx中使用active directory帐户可以正常工作。另外,设置active directory帐户后,它可以与IIS站点池配合使用
  • 如果我尝试为另一个AppPool设置权限(不是由安装程序创建的权限,例如IIS AppPool\DefaultAppPool),所有操作都可以正常工作。只有当我为安装程序创建的AppPool设置权限时,问题才会出现
  • 我检查了ConfigureIIs、SchedSecureObject和ExecSecureObjects的顺序,并尝试强制ConfigureIIs在其他两个对象之前执行(建议这样做)。不幸的是,这也没什么帮助

在服务器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
}

当我将WIX项目构建为x86时,我遇到了这个问题。我通过在配置IIS之前调度SchedSecureObjects和ExecSecureObjects解决了这个问题

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

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

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


这里也有同样的问题,正在寻找解决方案。在编写脚本时,这是个不错的主意。但要在创建用户身份和使用用户身份之间完全暂停Windows installer并不是一件容易的事——它按照内部定义的顺序执行所有操作。可能会创建一个延迟自定义操作,但该解决方案将非常尴尬
<Custom Action="SchedSecureObjects_x64" After="ConfigureIIs" />
<Custom Action="ExecSecureObjects_64" After="ConfigureIIs" />
<Custom Action="SchedSecureObjects" After="ConfigureIIs" />
<Custom Action="ExecSecureObjects" After="ConfigureIIs" />