c# - 添加或减去的值会导致无法表示的 DateTime。参数名称

标签 c# asp.net visual-studio-2012

我不断收到此异常,每隔一段时间就会发生一次。出于某种原因,我不认为它是我的代码,因为它也发生在不同的页面上。它也会发生在我没有 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/

相关文章:

c# - 我应该使用通用实用程序从多个字段生成 HashCode 吗?

c# - 如何使用相同的通用方法来验证不同类型

c# - mysql批量插入一个文本文件

c++ - 编写可与多个版本的 Tcl 一起使用的 Tcl 扩展

c# - 在 RichTextBox 中突出显示花费的时间太长

c# - asp.net 简单模式用法

asp.net - 从 WSDL 文件创建 ASMX Web 服务

c++ - libusb_hotplug_register_callback 不接受我的回调函数

c++ - 在 Visual Studio Express 2012 中包含路径

c# - 通过 ScrollViewer 的水平/垂直偏移制作动画