增加或减去的值会导致无法表示的DateTime。参数名称

时间:2013-10-09 03:21:33

标签: 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()

3 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

Max Value 23:59:59.9999999, December 31, 9999,

Min Value  00:00:00.0000000, January 1, 0001.

If your DateTime + TimeSpan< MinValue  Or DateTime + TimeSpan>MaxValue

您将获得例外,请确保您保持在界限内。

答案 2 :(得分:0)

当我试图使Cookie过期时我也一样,但现在its为我工作了:)

 var structure = [{
            label : "Value Date",
            field : "valueDate"
        }, {
            id: "currencyCol",
            label : "Currency",
            field : "currency"
        }, {
            label : "Nostro",
            field : "nostroAgent"
        }];

        var store= new RequestMemory({
            target: 'getReportData',
            idProperty: "cashflowId",
            headers: structure
        });
        // Create an instance of OnDemandGrid referencing the store
        var grid = new(declare([Grid, Pagination, Selection]))({
            collection: store,
            columns: structure,
            loadingMessage: 'Loading data...',
            noDataMessage: 'No results found.',
            minRowsPerPage: 50,
        }, 'grid');
        grid.startup(); 

      on(document.getElementById("filter"), "click", function(event) {
            event.preventDefault();
            grid.set('collection', store.filter({                   
                **currencyCol: "AED"**
                      .
                      .
                      .
            }));