IIS AppCmd语法,用于设置virtualDirectory的凭据 [英] IIS AppCmd syntax for setting credentials for virtualDirectory
问题描述
我正在使用appcmd
在IIS8中创建一个新的虚拟目录.语法是:
I'm using appcmd
to create a new virtual directory in IIS8. The syntax for this is:
appcmd add vdir /app.name:<NAME> /path:<PATH> /physicalPath:<PHYSICAL-PATH>
这很好.现在,我需要设置一些凭据;在GUI中这很容易(虚拟目录>基本设置>连接为).设置此项后,在我的applicationHost.config
文件中可以看到它正在更新XML条目.因此,我应该可以使用appcmd
手动进行设置.我在语法上苦苦挣扎,无法导航到正确的XML元素,因此可以设置属性userName
并添加属性password
.
This works fine. Now I need to set some credentials; this is easy in the GUI (virtual dir > basic settings > connect as). When I set this, I can see in my applicationHost.config
file that it is updating an XML entry. So I should be able to set that manually with appcmd
. I'm struggling with the syntax to navigate to the right XML element so I can set the attribute userName
and add the attribute password
.
这是我的XML:
<sites>
<site name="EXAMPLESITE" id="4">
<application path="/" applicationPool="EXAMPLEPOOL">
<virtualDirectory path="/" physicalPath="c:\wwwroot\" userName="" />
<virtualDirectory path="/upload" physicalPath="\\SOME-COMPUTER-ON-NETWORK\upload" userName="" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:80" />
</bindings>
</site>
</sites>
推荐答案
这应该有效:
appcmd set vdir /vdir.name:"EXAMPLESITE/upload" /userName:user /password:password
这篇关于IIS AppCmd语法,用于设置virtualDirectory的凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!