【发布时间】:2017-11-27 22:32:35
【问题描述】:
我正在使用 ASP.NET Core 来提供这样的 SPA:
[<Route("{*url}")>]
member this.Index () =
this.View("~/wwwroot/Index.cshtml")
我的 JSON 端点在同一个应用程序上,路由如下:
[<Route("api/something/{somethingId:int})>]
这很好用,除了当我尝试调用端点 api/something/that/doesnt/exist 时,当我真正想要 404 时,我得到了索引页。
是否可以设置[<Route("{*url}")>] 以排除任何以“api”开头的网址?
【问题讨论】:
标签: asp.net asp.net-core routing asp.net-core-mvc asp.net-core-webapi