【发布时间】:2015-04-06 12:20:38
【问题描述】:
当我尝试异步处理路由并在该路由中进行身份验证时,Nancy 会抛出 RouteExecutionEarlyExitException,然后返回状态代码 500(内部服务器错误)而不是 401(未授权)。
我的路由处理程序大致如下:
Get["route/to/private/stuff", true] = async (args, ct) =>
{
this.RequiresAuthentication()
// process request
}
我按照here 的指导方针配置了无状态身份验证。
当我的路由处理程序如下所示时,它按预期工作(内部抛出异常,但返回 401):
Get["route/to/private/stuff"] = args =>
{
this.RequiresAuthentication()
// process request
}
如何让 Nancy 在具有每个路由身份验证的异步路由处理程序中返回 401? 我正在使用 Nancy 1.0.0。
【问题讨论】:
标签: c# authentication asynchronous nancy