是否可以使用MSDeploy修改现有站点的web.config? [英] Is it possible to modify web.config of existing site using MSDeploy?

查看:53
本文介绍了是否可以使用MSDeploy修改现有站点的web.config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用MSDeploy修改(或仅替换)现有站点的web.config?

Is it possible to modify (or just replace) web.config of existing site using MSDeploy?

推荐答案

可以替换Web配置文件的某些部分(用xPath查询或正则表达式指定).为此,请使用-declareParam和-setParam命令行开关.

It's possible to replace certain sections (specified with an xPath query or regular expression) of the web config file. Use the -declareParam en -setParam commandline switches for that.

像这样

msdeploy -verb:sync -source:apphostconfig="Default Web Site" -dest:package=ParameterPackage.zip -declareParam:name=param,kind=XmlFile,scope=web.config,match=//add/@value 

等等:

msdeploy -verb:sync -source:package=ParameterPackage.zip -dest:auto -setParam:name=param,value=MyDefaultWebPage.htm

您可以在此处找到更多信息如果您使用的是命令行.

You can find more info here if you're using the command line.

如果您要使用IIS中的导入和导出程序包,则可以创建parameter.xml文件. Vishal Joshi有很多有关如何使用msdeploy的好帖子(例如)

If your working with importing and exporting packages in and from IIS you can create a parameters.xml file. Vishal Joshi has lots of good posts about how to use msdeploy (for example this)

这篇关于是否可以使用MSDeploy修改现有站点的web.config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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