debugging - IIS Express中的ASP.NET Core虚拟目录

标签 debugging visual-studio-2015 web-config asp.net-core iis-express

我使用VS2015在一个解决方案下创建了两个ASPNET核心Web和api项目

src
|
|-app.web
|  |-localhost:29999/
|  |-startup.cs 
|  
|-app.api
   |-localhost:29999/api/
   |-startup.cs (app.Map("/api", api => { /*configs and route*/ });)


并修改如下的.vs\config\applicationhost.config文件以使用虚拟目录

<site name="ThreeCON.Web" id="2">
    <application path="/" applicationPool="Clr4IntegratedAppPool">
      <virtualDirectory path="/" physicalPath="C:\proj\src\app.web\wwwroot" />
      <virtualDirectory path="/api" physicalPath="C:\proj\src\app.api\wwwroot" />
    </application>
    <bindings>
      <binding protocol="http" bindingInformation="*:29999:localhost" />
    </bindings>
</site>


当我在调试时尝试访问URL localhost:29999/api时,出现404 not found错误(其中localhost:29999/正常工作)

但是,当我通过在IIS中创建虚拟目录将其部署到开发服务器时,其工作正常。所以我该如何解决这个问题以与IIS Express一起使用

最佳答案

这里的问题是虚拟目录未被识别,因为是Kestrel处理此目录,而不是IIS Express。基本上,Kestrel不知道虚拟目录是否存在,因此它无法像这样提供服务。

答案中提供的answer here和随后的博客文章链接使我得出了这个结论,并解决了我也遇到的这个问题。

关于debugging - IIS Express中的ASP.NET Core虚拟目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36203922/

相关文章:

Eclipse 支持 .xsl 文件中的断点吗?

ios - Xcode DEBUG 模式 - 什么时候开/关?

javascript - 安装 visual Studio 2015 社区版后,Crystal Reports 13 bobj is undefined JavaScript 错误

c++ - 关于C中的任务递归(Visual Studio 15)

entity-framework - SimpleMembership 和 Entity Framework 可以共享连接字符串吗?

asp.net - 允许对 web.config 中的单个文件夹进行匿名身份验证吗?

c# - 调试 C# WinForm 应用程序

delphi - 如何阻止 F7 进入 Embarcadero 代码?

c# - 发布到 IIS 7.5 时出现 ASP.NET Core 404 错误

c# - 如何让每个开发人员拥有自己的私有(private) web.config?