设置IIS应用程序VirtualDirectory物理路径

时间:2018-07-19 08:32:57

标签: iis

我有一个.bat文件,其中包含运行appcmd的以下行,以安装sites.xml中包含的网站

%windir%\system32\inetsrv\appcmd add site /in < .\sites.xml

sites.xml包含以下内容

<?xml version="1.0" encoding="UTF-8"?>

<appcmd>

<SITE SITE.NAME="Default Web Site" SITE.ID="1" bindings="http/*:80:,net.tcp/808:*,net.pipe/*,net.msmq/localhost,msmq.formatname/localhost,https/*:443:" state="Started">

    <site name="Default Web Site" id="1" serverAutoStart="true">

        <bindings>

            <binding protocol="http" bindingInformation="*:80:" />

            <binding protocol="net.tcp" bindingInformation="808:*" />

            <binding protocol="net.pipe" bindingInformation="*" />

            <binding protocol="net.msmq" bindingInformation="localhost" />

            <binding protocol="msmq.formatname" bindingInformation="localhost" />

            <binding protocol="https" bindingInformation="*:443:" />

        </bindings>

        <limits />

        <logFile />

        <traceFailedRequestsLogging />

        <applicationDefaults />

        <virtualDirectoryDefaults />

        <application path="/">

            <virtualDirectoryDefaults />

            <virtualDirectory path="/" physicalPath="C:\inetpub\wwwroot" />

        </application>

         <application path="/MyWebsite" applicationPool="MyWebsite">

            <virtualDirectoryDefaults />

            <virtualDirectory path="/" physicalPath="D:\Projects\MySolution\DEV\Source\MyWebsite" />

        </application>

    </site>

</SITE>

</appcmd>

我需要使虚拟目录物理路径D:\Projects\MySolution的一部分成为当前目录。

我可以在sites.xml中插入任何变量来实现这一点吗?

0 个答案:

没有答案