开发者

How to retain folder permission during website deployment?

开发者 https://www.devze.com 2022-12-22 04:59 出处:网络
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 w

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.

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.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消