配置web.config以指向根文件夹

时间:2014-07-14 20:29:02

标签: asp.net iis web-config iis-express virtual-directory

你能帮我配置web.config,以便iis express从我的物理根文件夹开始解析所有网址。

例如,我希望在visual studio中拥有" webroot"我所有网络文件的文件夹。 C:/dev/myWebMvcApplication/webroot/app/index.html。 哪里: myWebMvcApplication是我的解决方案的文件夹,[。sln] 和webroot是一个包含我所有文件的物理文件夹,

所以,所有网址都可能看起来像 /localhost:port/app/index.html 而不是喜欢 /localhost:port/webroot/app/index.html

1 个答案:

答案 0 :(得分:0)

从IIS7开始,更改服务器中的站点现在通常在applicationHost.config的sites部分中完成。

<sites>
    <site name="Blah Blah" id="1">
        <application path="/" applicationPool="DefaultAppPool">
            <virtualDirectory path="/" physicalPath="C:/dev/myWebMvcApplication/webroot" />
        </application>
        <bindings>
            <binding protocol="HTTP" bindingInformation="*:80:" />
        </bindings>
     </site>
</sites>

我假设您正在讨论更改网络服务器的根目录,以便解决方案下的所有应用程序共享相同的基本URL。如果这是一个不正确的假设,请告诉我。