网站部署期间如何保留文件夹权限? [英] How to retain folder permission during website deployment?

查看:88
本文介绍了网站部署期间如何保留文件夹权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个生产网站,该网站一旦内置于TFS中,便会使用xcopy重新部署和更新.删除了整个站点(根目录除外),然后复制了新站点.这很好.

I have a production website that, once built in TFS is re-deployed and updated using xcopy. The entire site (excluding the root directory) it deleted then the new site copied in. This works well.

我们使用第三方制图程序包,该程序包在运行时创建图像,然后呈现指向它们的链接.为此,它需要对可浏览文件夹的写权限.

We use a 3rd party charting package that creates images at runtime and then renders a link to them. In order to do this it needs write permissions to a browsable folder.

不幸的是,每次我们更新网站时,IIS_USRS的写入权限都会丢失.有什么办法可以保留吗?

Unfortunately, every time we update the website the write permissions of IIS_USRS is lost. Is there any way to retain this?

推荐答案

我想这取决于服务器正在运行的操作系统,是否要在与要部署到的服务器相同的服务器上或在远程服务器上构建

I guess it depends on what operating system the server is running, and whether you are building on the same server as you're deploying to, or a remote one.

最简单的方法是将xcopy命令放入批处理文件中,并在xcopy之后添加如下内容:

The simplest thing to do is to put your xcopy command into a batch file, and include something like the following after the xcopy:

cacls c:\[PathToWebsite]\[ChartImagesFolder] /E /G [AccountSiteRunsUnder]:C

或更先进的选择(我没有使用过,所以我的参数可能关闭了):

Or a more up to date option (I've not used this, so my parameters may be off):

icacls c:\[PathToWebsite]\[ChartImagesFolder] /grant [AccountSiteRunsUnder]:M

基本上,这两个选项中的任何一个都应在指定文件夹中的修改(更改)权限下为用户提供站点正在运行的帐户.这应该是该文件夹上所有现有权限的补充,并且可以使用修饰符或开关来替换现有权限.

Basically, either of those should give the user account that the site is running under modify (change) rights in the folder specified. This should be in addition to any existing rights on the folder, there are modifiers or switches to replace the existing rights.

如果要部署到远程服务器,则需要某种机制在该服务器上运行命令,我们发现

If you are deploying to a remote server, you'll need some mechanism to run commands on there, we've found that PSExec works a treat (part of the PS tools from SysInternals).

这篇关于网站部署期间如何保留文件夹权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆