我不断收到此异常,每隔一段时间就会发生一次。出于某种原因,我不认为它是我的代码,因为它也发生在不同的页面上。它也会发生在我没有 DateTime 对象的页面上。
此外,当应用程序异常转到一行代码时,出现的异常窗口是不同的。当发生此异常时,情况并非如此。在顶部它说代码堆栈只包含外部代码。
The added or subtracted value results in an un-representable DateTime.
at System.DateTime.op_Addition(DateTime d, TimeSpan t)
at System.Web.HttpContext.MustTimeout(DateTime utcNow)
at System.Web.RequestTimeoutManager.RequestTimeoutEntry.TimeoutIfNeeded(DateTime now)
at System.Web.RequestTimeoutManager.CancelTimedOutRequests(DateTime now)
at System.Web.RequestTimeoutManager.TimerCompletionCallback(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.TimerQueueTimer.CallCallback()
at System.Threading.TimerQueueTimer.Fire()
at System.Threading.TimerQueue.FireNextTimers()
最佳答案
System.Web.HttpContext.MustTimeout
似乎是 involved in coordinating request timeouts .为此,我设想...
System.DateTime.op_Addition(DateTime d, TimeSpan t)
...是 MustTimeout
计算请求超时的时间。它可以通过向请求的开始时间添加一些超时值来实现。
检查您没有任何人为高或无效的超时(在 web.config
或其他地方)。例如:
<system.web>
<httpRuntime executionTimeout="999999999999" />
</system.web>
记录了各种超时 in this Stack Overflow answer .
关于c# - 添加或减去的值会导致无法表示的 DateTime。参数名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19262505/