简体   繁体   English

IIS - 使用 appcmd 设置应用程序的物理路径

[英]IIS - Setting the physical path of an Application with appcmd

In IIS, I have a web site "Default Web Site" with an application "test2".在 IIS 中,我有一个带有应用程序“test2”的 web 站点“默认 Web 站点”。 I want to set the physical path of that application to "E:\temp\out1".我想将该应用程序的物理路径设置为“E:\temp\out1”。 That directory already exists.该目录已经存在。

When I run this in Powershell (as an administrator):当我在 Powershell 中运行它时(作为管理员):

appcmd.exe set app "Default Web Site/test2" -[path='/'].physicalpath:E:\temp\out1

I get this error message:我收到此错误消息:

ERROR ( message:Malformed collection indexer; format is [@position,name='value',name2='value2',...].  The @position specifier is optional, and be '@start', '@end', or '@N' where N is a numeric index into the collection. )

I have no idea what that means.我不知道那是什么意思。

Would very much appreciate a working example of using appcmd to set the physical path of an IIS application.非常感谢使用 appcmd 设置 IIS 应用程序的物理路径的工作示例。

Turns out that the command in my question actually works on Command Prompt.事实证明,我的问题中的命令实际上适用于命令提示符。 However, I tried to run it from a Powershell prompt, and there I got the error message.但是,我尝试从 Powershell 提示符中运行它,然后我收到了错误消息。

I couldn't find a way to run the command from Powershell.我找不到从 Powershell 运行命令的方法。 In the end, my solution was to write the command to a temporary.bat file, then execute that file from Powershell.最后,我的解决方案是将命令写入临时.bat 文件,然后从 Powershell 执行该文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM