【问题标题】:Nancyfx executes the route but does not return a result. (Running on Raspberry pi Mono)Nancyfx 执行路由但不返回结果。 (在树莓派 Mono 上运行)
【发布时间】:2013-04-16 15:58:22
【问题描述】:

我目前在我的树莓派上运行 Mono JIT 编译器版本 2.10.8.1 (Debian 2.10.8.1-5)。我从 master 分支编译了 nancyfx monorelease 配置。

应用程序按预期启动

Nancy now listening - navigating to http://localhost:8888/nancy/. 
Press enter to stop

然后我运行如下测试

pi@raspberrypi ~ $ wget  http://localhost:8888/nancy/
--2013-04-13 06:39:12--  http://localhost:8888/nancy/
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:8888... connected.
HTTP request sent, awaiting response... 

这永远不会完成。它就在那里。

我添加了一些日志记录,我可以看到它处理模块上的路由操作,但它似乎从未返回 http 响应。

有人见过这个吗?有没有办法添加更多的异常捕获?

以下内容没有透露任何信息。

 public class LoggingErrorHandler : IErrorHandler
{
    private readonly ILog _logger = LogManager.GetLogger(typeof(LoggingErrorHandler));

    public bool HandlesStatusCode(HttpStatusCode statusCode)
    {
        return statusCode == HttpStatusCode.InternalServerError;
    }

    public bool HandlesStatusCode(HttpStatusCode statusCode, NancyContext context)
    {
        return statusCode == HttpStatusCode.InternalServerError;
    }

    public void Handle(HttpStatusCode statusCode, NancyContext context)
    {
        object errorObject;
        context.Items.TryGetValue(NancyEngine.ERROR_EXCEPTION, out errorObject);
        var error = errorObject as Exception;
        _logger.Error("Unhandled error", error);
    }
}

有什么想法吗?

谢谢

【问题讨论】:

  • 我也有同样的问题,你解决了吗?

标签: mono response raspberry-pi nancy


【解决方案1】:

我从未见过这个 - 你要返回的是什么?当您创建 NancyHost 时,您可以提供一个 HostConfiguration 对象,其中一个属性是 UnhandledExceptionCallback,这可能有助于了解发生了什么问题。

【讨论】:

    猜你喜欢
    • 2019-05-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多