我正在尝试在 Visual Web Developer Express 2010 中构建一个部署包,它为已部署网站的子文件夹设置 ACL。我使用了以下信息http://leethams.wordpress.com/2010/06/12/modifying-directory-permissions-with-web-deployment/
这是我的测试:
创建一个新的空白 ASP.NET 应用程序(本例中为 WebApplication2)
在高级编译选项中,将 .NET Framework 目标版本更改为 3.5
创建一个新文件夹(本例中为 Config)并在文件夹中添加任何文件
使用此内容创建一个名为 WebApplication2.wpp.targets 的新文件
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Extends the AfterAddIisSettingAndFileContentsToSourceManifest action do also set ACLs -->
<IncludeCustomACLs>TRUE</IncludeCustomACLs>
<AfterAddIisSettingAndFileContentsToSourceManifest Condition="'$(AfterAddIisSettingAndFileContentsToSourceManifest)'==''">
$(AfterAddIisSettingAndFileContentsToSourceManifest);
SetCustomACLs;
</AfterAddIisSettingAndFileContentsToSourceManifest>
</PropertyGroup>
<Target Name="SetCustomACLs" Condition="'$(IncludeCustomACLs)'=='TRUE'">
<Message Text="Adding Custom ACls" />
<ItemGroup>
<MsDeploySourceManifest Include="setAcl" Condition="$(IncludeSetAclProviderOnDestination)">
<setAclUser>anonymousAuthenticationUser</setAclUser>
<path>$(_MSDeployDirPath_FullPath)</path>
<setAclAccess>Read,Write</setAclAccess>
<setAclResourceType>Directory</setAclResourceType>
<AdditionalProviderSettings>setAclResourceType;setAclAccess</AdditionalProviderSettings>
</MsDeploySourceManifest>
</ItemGroup>
</Target>
</Project>
我从命令行执行,一切正常:
-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T
emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest
:auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:
ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp
lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml"
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Número total de cambios: 3 (0 agregados, 0 eliminados, 3 actualizados, 0 parámet
ros cambiados, 0 bytes copiados)
现在,要设置 Config 文件夹的权限,我更改以下行并重新构建部署包。
<path>$(_MSDeployDirPath_FullPath)/Config</path>
我收到以下错误:
-------------------------------------------------------
Start executing msdeploy.exe
-------------------------------------------------------
"C:\Program Files\IIS\Microsoft Web Deploy\\msdeploy.exe" -source:package='C:\T
emp\WebApplication2\WebApplication2\obj\Debug\Package\WebApplication2.zip' -dest
:auto,includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:
ContentExtension -disableLink:CertificateExtension -setParamFile:"C:\Temp\WebApp
lication2\WebApplication2\obj\Debug\Package\WebApplication2.SetParameters.xml"
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (Default Web Site/WebApplication2_deploy).
Info: Actualizando setAcl (C:\Temp\WebApplication2\WebApplication2\obj\Debug\Pac
kage\PackageTmp/Config).
Error: Se debe especificar un valor para 'setAclUser' cuando se usa el proveedor
'setAcl' con una ruta de acceso física.
Recuento de errores: 1.
在英文中它说:“错误:在使用带有物理路径的 'setAcl' 提供程序时,必须指定 'setAclUser' 的值”。请注意,第三个 setAcl 已更改为部署包所在的物理路径。
然后我尝试以这种方式修改它:
<AdditionalProviderSettings>setAclUser;setAclResourceType;setAclAccess</AdditionalProviderSettings>
但错误仍然存在。如果我使用“/t”开关执行部署包,它不会抛出错误,尽管它仍然显示物理路径。我可以硬编码 IIS 路径并像这样更改行:
<path>Default Web Site/WebApplication2_deploy/Config</path>
它工作正常。但是,我不想这样做,因为需要参数化安装路径。
将路径更改为反斜杠没有任何区别:
<path>Default Web Site/WebApplication2_deploy\Config</path>
任何帮助,将不胜感激。谢谢