我正在尝试通过 msdeploy 从我在源 IIS 7 站点上创建的包中恢复目标计算机上的站点。目的服务器IIS也是IIS7。 然而,目标服务器没有驱动器 D: 作为物理驱动器。 D: 与 CD 行驱动器相关联。 我在使用 msdeploy 时使用了替换属性,但该规则不起作用。 下面是我的命令 msdeploy -verb:sync -source:package=d:\site.zip -dest:apphostconfig="默认网站"-replace:objectName="metaProperty",scopeAttributeName="name",scopeAttributeValue="Path",targetAttributeName="value",match="d:",replace="c:"-verbose -whatif > msdeploysync.log
但是,-whatif 不显示更改为 C: 的路径,而且如果我运行该命令,我会收到消息“设备未准备好”,这意味着 D: 替换不工作。
我卡住了..有什么帮助吗?
最佳答案
提供的用于更改路径的机制(请注意,以非 IIS 版本特定的方式)是设置类型为 DestinationVirtualDirectory
的参数:
-setParam:kind=DestinationVirtualDirectory,scope="Default Web Site",value="c:\full\path\to\website"
如果您只想简单地更换驱动器,请尝试将您的更换指令更改为:
-replace:objectName=virtualDirectory,scopeAttributeName=physicalPath,match=^C:,replace=D:
这里有一些关于各种参数类型的官方文档:Using declareParam and setParam
关于Msdeploy 替换属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12488886/