4
2016-12-02 02:54:39:180 [WARNING] Microsoft.AspNetCore.Server.Kestrel -    Connection processing ended abnormally
Microsoft.AspNetCore.Server.Kestrel.BadHttpRequestException: The input string contains non-ASCII or null characters.
at Microsoft.AspNetCore.Server.Kestrel.Internal.Infrastructure.MemoryPoolIteratorExtensions.GetAsciiString(MemoryPoolIterator start, MemoryPoolIterator end)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame.TakeStartLine(SocketInput input)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()
2016-12-02 09:17:10:819 [ERROR] Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred: Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Gillie.JobCenter.Controllers.WebApi.QuestionnairesController.<SaveConsultant>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ObjectMethodExecutor.<CastToObject>d__40`1.MoveNext()

我只遇到过一次这个异常,我无法重现。也许有人知道出现此错误的情况,我会尝试重现。

4

1 回答 1

6

与其尝试猜测可能导致错误的输入,不如使用 HTTP 日志文件来查看实际请求的样子。以我的经验,在没有很好地了解问题根源的情况下盯着代码是徒劳的。如果您不能轻松地重现该问题,那么对代码的任何猜测都不太可能有帮助。您应该从另一端解决问题:尝试重现它。识别导致错误的输入。

编辑:你用谷歌搜索过这个错误信息吗?由于客户端的一些错误 cookie,其他人似乎在使用 Kestrel 提供此消息时遇到问题。这可能是 cookie 处理中的 Kestrel 错误。也许仅记录有关 cookie 的信息就足以识别问题,并且您不需要记录所有 POST 数据。见https://github.com/aspnet/KestrelHttpServer/issues/949

你在使用旧版本的 Docker for Windows 吗?

于 2017-01-05T14:03:57.963 回答