【发布时间】:2018-07-20 15:14:58
【问题描述】:
我正在尝试运行 ASP.NET Core 服务器。我的服务器请求返回 200 OK,但没有返回任何内容,据我所知,控制器甚至没有被实例化。
Azure 流式日志的最后输入如下所示:
应用程序:2018-07-20 13:42:13.294 +00:00 [调试] Microsoft.AspNetCore.Routing.Tree.TreeRouter:请求成功匹配名称为'(null)'和模板'api / {的路由文化}/NotificationsReceived/{upToUtc}/{take}'。 应用程序:2018-07-20 13:42:13.670 +00:00 [调试] Microsoft.AspNetCore.Server.Kestrel:连接 ID“0HLFE8PANI4TL”完成保持活动响应。 应用程序:2018-07-20 13:42:13.670 +00:00 [信息] Microsoft.AspNetCore.Hosting.Internal.WebHost:请求在 413.5636ms 200 内完成
所以路由匹配并且请求完成,但我尝试将断点附加到控制器(远程调试器附加,但没有断点被命中,即使在我的中间件中也是如此),并从控制器记录信息如下:
[<Authorize>]
[<Route("api/{culture}/[controller]")>]
type NotificationsReceivedController(notifications: IReceivedNotifications, logger: ILog) =
inherit Controller()
do logger.Information "NotificationsReceivedController" "Created controller" None
[<HttpGet("{upToUtc}/{take}")>]
[<ProducesResponseType(200, Type = typeof<PageOfNotifications>)>]
member this.Get(upToUtc:int64, take:int) =
async {
let upToUtc = new DateTime(upToUtc, DateTimeKind.Utc)
logger.Information "NotificationsReceivedController" "GetReceivedNotifications endpoint" None
let! notifications = notifications.GetAsync this.HttpContext upToUtc take
return this.Ok(notifications) :> IActionResult
} |> Async.StartAsTask
我不明白误报。如果我的管道出现问题,为什么没有在日志中找到它?如果没有任何问题,为什么路由匹配,但控制器没有被实例化?
【问题讨论】:
标签: .net f# azure-web-app-service asp.net-core-2.0