我在使用VS2015创建的一个解决方案中,创建了两个ASP.NET Core 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未找到
的错误(其中localhost:29999/
可以正常工作)。
但是,当我通过在IIS中创建虚拟目录将其部署到开发服务器时,它可以正常工作。那么我该如何修复这个问题以使其与IIS Express一起正常工作?