Visual Studio 2015添加虚拟目录 [英] Visual Studio 2015 add virtual directory
问题描述
我在VS2015中有一个Web项目(使用IIS Express),需要为可以下载但由另一个进程创建的文件添加虚拟目录.我已经在我的applicationhost.config文件中添加了一个条目,如下所示.每当我启动服务器并直接转到该位置处的文件时,IIS Express日志中都会收到404.
I have a web project in VS2015 (using IIS Express) and need to add a virtual directory for files that can be downloaded but are created by another process. I have added an entry to my applicationhost.config file as shown below. Whenever I start my server and go directly to a file at the location I receive a 404 in the IIS Express log.
<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中添加这样的虚拟目录是否有所不同?
Is there something different in VS2015 to add a virtual directory like this?
我正在编辑项目dir/.vs/config/applicationhost.config中的配置文件.
I am editing the config file in my project dir/.vs/config/applicationhost.config.
推荐答案
对于VS.Net 2015:
For VS.Net 2015:
1.-打开位于以下路径中的文件applicationhost.config:
1.- Open the file applicationhost.config located in the following path:
{您的解决方案文件夹} \.vs \ config \
{your_solution_folder}\.vs\config\
2.-搜索标签"sites",并找到要创建虚拟目录的项目的标签.
2.- Search for the tag "sites" and find the tag for the project you want to create the virtual directory.
3.-添加以下行:
<application path="/{your_virtual_directory_name}" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="{your_physical_path}" />
</application>
类似于以下内容:
这篇关于Visual Studio 2015添加虚拟目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!