我正在尝试在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>
工作正常。但是,我不想那样做,因为安装路径需要参数化。
将路径更改为backslassh没有任何区别:
<path>Default Web Site/WebApplication2_deploy\Config</path>
任何帮助将不胜感激。 感谢
答案 0 :(得分:2)
我认为这里的链接显示了如何参数化路径。
Can Web Deploy's setAcl provider be used on a sub-directory?