zoukankan      html  css  js  c++  java
  • [转]Solutions of Error "PageRequestManagerTimeoutException"

    Introduction

    Recently, I encountered a weird problem. A method invoked a store procedure that expends more than 90 seconds, and the button which invokes that method is inside an updatepanel. The error message is "SysWebForms.PageRequestManagerTimeoutException: The server request timed out.".

    Background

    After doing a search in the internet, I found it is caused by the property AsyncPostBackTimeout of ScriptManager. It has an integer value that represents the time-out in seconds. The default value of the AsyncPostBackTimeOut property is 90 seconds. But my procedure will last for 200 seconds.

    Solution One

    Most articles suggested adding the property-value likes "AsyncPostBackTimeout=360000" in ASPX control.

    Example:

    <asp:ScriptManager ID= "ScriptManager1 " AsyncPostBackTimeOut= "360000 " runat= "server " />

    Solution Two

    But recently I am using DNN framework. If using "AJAX.RegisterScriptManager()", there shouldn't be any ScriptManager control exists in the DNN module file. But we can get the current registered ScriptManage object and set the AsyncPostBackTimeout property, or use the SetScriptManagerProperty() method through the following steps.

    Example:

    if (AJAX.IsInstalled()) {     AJAX.RegisterScriptManager();     ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page);     scriptManager.AsyncPostBackTimeout = 360000; }

    OR: use the SetScriptManagerProperty method in DotNetNuke.Framework.AJAX class.

    Example:

    if (AJAX.IsInstalled()) {     AJAX.RegisterScriptManager();     AJAX.SetScriptManagerProperty(this.Page, "AsyncPostBackTimeout", new Object[] { 360000 }); }

    Solution Three

    Actually, we can hide this problem of "PageRequestManagerTimeoutException" by adding the below javascript. But it is not recommended.

    Example:

    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) {   if (args.get_error() != undefined)    {        else if(args.get_error().name === 'Sys.WebForms.PageRequestManagerTimeoutException')        {             args.set_errorHandled(true);        }        else        {            // not this kind of error so let the default behavior happen.        }    } }

    If you have any questions, don’t feel hesitate to ask me.

  • 相关阅读:
    微信運動步數
    JS逐页转pdf文件为图片格式
    js学习笔记]PDF.js专题
    PDF轉圖片流並jquery顯示到頁面
    使用 pdf.js 在网页中加载 pdf 文件
    使用pdfobject.js实现在线浏览PDF
    Echarts的使用
    C# ffmpeg 视频处理
    C#文件/文件夾壓縮,解壓縮
    epplus插入圖片/鏈接
  • 原文地址:https://www.cnblogs.com/LeoWong/p/2134330.html
Copyright © 2011-2022 走看看