我知道这个帖子是非常古老的,但我们最近遇到了同样的问题。如果您使用的是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