Visual Studio 2015添加虚拟目录

2024-03-13

我在 VS2015 中有一个 Web 项目(使用 IIS Express),需要为可以下载但由另一个进程创建的文件添加一个虚拟目录。我已在 applicationhost.config 文件中添加了一个条目,如下所示。每当我启动服务器并直接转到该位置的文件时,我都会在 IIS Express 日志中收到 404 错误。

<site name="CustomerPortal" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
      <virtualDirectory path="/" physicalPath="C:\Dev\WebApps\CustomerPortal\src\CustomerPortal\wwwroot" />
      <virtualDirectory path="/WebReports" physicalPath="\\backup03\WebReports" />
    </application>

    <bindings>
                <binding protocol="http" bindingInformation="*:49373:localhost" />
    </bindings>
</site>

VS2015中添加这样的虚拟目录有什么不同吗?

我正在编辑项目 dir/.vs/config/applicationhost.config 中的配置文件。


对于 VS.Net 2015:

1.- 打开位于以下路径的 applicationhost.config 文件:

{您的解决方案文件夹}\.vs\config\

2.- 搜索标签“sites”并找到您要创建虚拟目录的项目的标签。

3.- 添加以下行:

<application path="/{your_virtual_directory_name}" applicationPool="Clr4IntegratedAppPool">
   <virtualDirectory path="/" physicalPath="{your_physical_path}" />
</application>

It will be something like the following: enter image description here

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Visual Studio 2015添加虚拟目录 的相关文章

随机推荐