我知道這個帖子是非常古老的,但我們最近遇到了同樣的問題。如果您使用的是IIS 7(或更高版本),那麼可以採用解決方法。您可以使用IIS 7附帶的AppCmd.exe
執行許多不同的操作,以您的情況在不同網站下創建應用程序。
您可以創建一個樣本南特任務(宏):
<Install.App websiteName="SomeOtherWebsite" vdir="/MyApp" physicalPath="C:\apps\myapp" appPool="MyAppPool" />
這將創建一個名爲應用程序「MyApp的:
<macrodef name="Install.App">
<attributes>
<attribute name="websiteName" default="Default Web Site" />
<attribute name="vdir" />
<attribute name="physicalPath" />
<attribute name="appPool" default="DefaultAppPool" />
</attributes>
<sequential>
<exec program="c:\windows\System32\InetSrv\appcmd.exe" workingdir="${project::get-base-directory()}" verbose="true" failonerror="false" >
<arg value="ADD"/>
<arg value="APP" />
<arg value=""/site.name:${websiteName}""/>
<arg value="/path:${vdir}" />
<arg value="/physicalPath:${physicalPath}" />
<arg value="/apppool.name:${appPool}" />
</exec>
</sequential>
</macrodef>
然後,你可以簡單地用這樣的稱呼它「在該服務器上的」SomeOtherWebsite「網站內。
這會創建一個應用程序,但您也可以通過將<arg value="APP" />
更改爲<arg value="VDIR" />
來創建普通虛擬目錄。欲瞭解更多信息和選項,您可以read more here。
我希望能幫助一些其他人也陷入同樣的位置!
這個工作時,你有不同港口的網站 – Miral 2011-01-19 14:04:37