Results 1 to 15 of 15

Thread: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Resolved [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Getting the following error randomly on my .aspx that involves javascript and AJAX. It seems to be happening if I don't run the process on the page for 10-15 minutes. After I get one time out it usually works the next try and increasingly gets faster every time after that until it sits idle again.

    This page is using a pretty simple stored proc to populate a gridview that is inside an updatepanel.

    I get a popup box with the following error:

    Sys.WebForms.pageRequestManager TimeoutException : the server request timed out

    Code:
    <%@ Page Language="VB" AutoEventWireup="true" CodeFile="Cust_CM.aspx.vb" Inherits="_Default" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>A/R Credit Memos</title>
        <link href="StyleA.css" rel="stylesheet" type="text/css" />
    
    </head>
    <body>
    
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <div>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Panel ID="Panel2" runat="server" Height="50px" Style="text-align: right" Width="608px">
                            <div style="float: left; width: 200px; height: 100px; text-align: left">
                                                            <br />
                        <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Size="Larger" Text="Credit Memos"
                            Width="192px"></asp:Label><br />
                            </div>
                            <asp:Panel ID="Panel1" runat="server" Height="50px" Width="400px" style="text-align: left">
                                &nbsp;<br />
                                <br />
                                <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                    <ProgressTemplate>
                                        Generating Data...<br />
                                        <img src="pleasewait.gif" />
                                    </ProgressTemplate>
                                </asp:UpdateProgress>
                            </asp:Panel>
                        </asp:Panel>
                        <br />
                        <br />
                            <table style="width: 576px" >
                                <tr>
                                    <td style="width: 114px">
                                        <asp:Label ID="Label1" runat="server" Font-Bold="True" Text="Invoice Date:" Width="96px"></asp:Label></td>
                                    <td style="width: 175px">
                                        <asp:TextBox ID="txtInvoiceDateFrom" runat="server" Width="96px"></asp:TextBox>&nbsp;
                                        <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtInvoiceDateFrom">
                                        </cc1:CalendarExtender>
                                    </td>
                                    <td style="width: 15px">
                                        <asp:Label ID="Label2" runat="server" Font-Bold="True" Text="To"></asp:Label></td>
                                    <td>
                                        &nbsp;<asp:TextBox ID="txtInvoiceDateTo" runat="server" Width="96px"></asp:TextBox>&nbsp;
                                        <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtInvoiceDateTo">
                                        </cc1:CalendarExtender>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 114px">
                                        <asp:Label ID="Label3" runat="server" Font-Bold="True" Text="Project Number" Width="112px"></asp:Label></td>
                                    <td colspan="2">
                                        <asp:TextBox ID="txtProjectNumber" runat="server"></asp:TextBox></td>
                                    <td>
                                        <asp:Button ID="btnShow" runat="server" Text="Show Report" OnClick="btnShow_Click" /></td>
                                </tr>
                            </table>
                            <asp:Label ID="lblError" runat="server" ForeColor="Red" Width="576px"></asp:Label><br />
                        <asp:GridView ID="gvResults" runat="server" AutoGenerateColumns="False" EmptyDataText="There were no results to your query.">
                            <Columns>
                                <asp:BoundField DataField="MainProject" HeaderText="Project" />
                                <asp:BoundField DataField="BillTask" HeaderText="Task" />
                                <asp:BoundField DataField="invoice" HeaderText="Invoice No" />
                                <asp:BoundField DataField="InvoiceDate" DataFormatString="{0:d}" HeaderText="Invoice Dt"
                                    HtmlEncode="False" />
                                <asp:BoundField DataField="Description" HeaderText="Description" HtmlEncode="False" />
                                <asp:BoundField DataField="footer" HeaderText="Footer" HtmlEncode="False" />
                            </Columns>
                            <RowStyle BackColor="#E0E0E0" />
                            <HeaderStyle BackColor="Silver" />
                        </asp:GridView>
                        &nbsp;&nbsp;
    
                    </ContentTemplate>
                </asp:UpdatePanel>
                
            </div>
        </form>
    
    </body>
        <script type="text/javascript">
    
            Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
    
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler)
    
            function BeginRequestHandler(sender, args)
            {
            var btn = document.getElementById("<%= btnShow.ClientID %>");   
            btn.disabled = true; 
            var txt1 = document.getElementById("<% = txtInvoiceDateFrom.ClientID %>");
            txt1.disabled = true;
            txt1 = document.getElementById("<% = txtInvoiceDateTo.ClientID %>");
            txt1.disabled = true;
            txt1 = document.getElementById("<% = txtProjectNumber.ClientID %>");
            txt1.disabled = true;
            return false;
            }
    
            function EndRequestHandler(sender, args)
            {
            var btn = document.getElementById("<%= btnShow.ClientID %>");   
            btn.disabled = false; 
            var txt1 = document.getElementById("<% = txtInvoiceDateFrom.ClientID %>");
            txt1.disabled = false;
            txt1 = document.getElementById("<% = txtInvoiceDateTo.ClientID %>");
            txt1.disabled = false;
            txt1 = document.getElementById("<% = txtProjectNumber.ClientID %>");
            txt1.disabled = false;
            return false;
            }
    
            </script>
    </html>
    vb Code:
    1. Partial Class _Default
    2.     Inherits System.Web.UI.Page
    3.  
    4.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    5.  
    6.     End Sub
    7.     Private Sub BindGrid()
    8.         Dim cmd As New XSQL("XXXXX", 2)
    9.  
    10.         Try
    11.             cmd.AddStrParam("@Project", txtProjectNumber.Text, 20)
    12.             cmd.AddStrParam("@StDate", txtInvoiceDateFrom.Text, 10)
    13.             cmd.AddStrParam("@EndDate", txtInvoiceDateTo.Text, 10)
    14.             gvResults.DataSource = cmd.ExecuteDS("USP_GetCreditMemos")
    15.             gvResults.DataBind()
    16.             lblError.Text = ""
    17.         Catch ex As Exception
    18.             lblError.Text = ex.Message
    19.         End Try
    20.  
    21.     End Sub
    22.  
    23.     Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs)
    24.  
    25.         If txtProjectNumber.Text = "" Then
    26.             If txtInvoiceDateFrom.Text <> "" And txtInvoiceDateTo.Text <> "" Then
    27.                 BindGrid()
    28.             Else
    29.                 Show("You must enter a Project Number if you are not using a date range.")
    30.             End If
    31.         Else
    32.             BindGrid()
    33.         End If
    34.  
    35.  
    36.     End Sub
    37.     Private Sub Show(ByVal message As String)
    38.         Dim strScript As String
    39.         strScript = "<script type='text/javascript' language='javascript'>"
    40.         strScript = strScript & "alert('" & message & "');"
    41.         strScript = strScript & "</script>"
    42.  
    43.         ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "alert", strScript, False)
    44.  
    45.     End Sub
    46.  
    47.  
    48. End Class

  2. #2
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    592

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    You are missing the connection. At least i couldn't see the declaration of the connection nor opening the same object. Maybe you want to switch to regular debug and see the exception source?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    the connection is in the XSQL class. What do you mean by regular debug?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Second post here?

    http://www.dotnet-friends.com/Forum/...00&ThreadNew=0

    Although it's a workaround rather than the real problem... is it attempting to repopulate the grid every x seconds?

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Yeah I saw that post upon my searches. If I do extend the timeout period I won't get the error and the grid will populate eventually. The thing is that this is a very simple page and simple stored proc consisting of one select statement. And as I mentioned in post #1 that it gets faster every time after it times out. This only occurs after it's been idle for a while. I've tried removing the javascript also because I am pretty noob when it comes to straight javascript and it had no affect.

    This is my XSQL class if anyone thinks there is something in there that might be causing this to happen.

    vb Code:
    1. Imports System.Data.SqlClient
    2. Imports System
    3. Imports System.Data
    4.  
    5. Public Class XSQL
    6.     Private rows As Int32, cols As Int16, retVal As Int64
    7.  
    8.     Protected adoCon As New SqlConnection()
    9.     Protected adoCmd As New SqlCommand()
    10.     Protected adoDR As SqlDataReader    'if the user needs a data reader
    11.     Protected adoDA As New SqlDataAdapter() 'if the user needs a data set
    12.     Protected adoDS As New DataSet() 'if the user needs a data set
    13.     Private myTrans As SqlTransaction
    14.  
    15.     Public Shared Function getConnString(ByVal AppId As String) As String
    16.         Dim userId As String = "XXXXX"
    17.         Dim pwd As String = "XXXXX"
    18.  
    19.         Dim connStr1 As String
    20.         Dim connStr2 As String = "uid=" & userId & ";password=" & pwd & ";Connect Timeout=30"
    21.  
    22.         Select Case AppId
    23.  
    24.             Case "XXXXX"
    25.                 connStr1 = "server=XXXXX;database=XXXXX;"
    26.         End Select
    27.  
    28.         Return (connStr1 & connStr2)
    29.  
    30.     End Function
    31.  
    32.     Public Sub BeginTran()
    33.         myTrans = adoCon.BeginTransaction(IsolationLevel.ReadCommitted, "xTran")
    34.         adoCmd.Transaction = myTrans
    35.     End Sub
    36.  
    37.     Public Sub CommitTran()
    38.         myTrans.Commit()
    39.     End Sub
    40.  
    41.     Public Sub RollbackTran()
    42.         myTrans.Rollback("xTran")
    43.     End Sub
    44.  
    45.     Sub New(ByVal AppId As String, Optional ByVal cmdType As Integer = 1, Optional ByVal rsType As Integer = 1)
    46.         'cmdType 1 = sqlcommand; cmdType 2 = stored procedure
    47.         'rsType 1 returns DataReader; rsType 2 returns dataset
    48.  
    49.         adoCon.ConnectionString = getConnString(AppId)
    50.  
    51.         If cmdType = 2 Then
    52.             adoCmd.CommandType = CommandType.StoredProcedure
    53.         Else
    54.             adoCmd.CommandType = CommandType.Text
    55.         End If
    56.  
    57.         adoCmd.CommandTimeout = 120
    58.         adoCmd.Connection = adoCon
    59.  
    60.         'if returning a dataset, dont ve to open the connection; the sqldataAdapter takes care of it
    61.         'open the connection only if returning dataReader
    62.         If rsType = 1 Then
    63.             adoCon.Open()
    64.         End If
    65.  
    66.     End Sub
    67.  
    68.     Public Sub AddDateParam(ByVal pName As String, ByVal pValue As DateTime)
    69.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.DateTime)
    70.         myParm.Value = pValue
    71.  
    72.     End Sub
    73.  
    74.     Public Sub AddSmallDateParam(ByVal pName As String, ByVal pValue As DateTime)
    75.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.SmallDateTime)
    76.         myParm.Value = pValue
    77.  
    78.     End Sub
    79.     Public Sub AddIntParam(ByVal pName As String, ByVal pValue As Integer)
    80.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.Int)
    81.         myParm.Value = pValue
    82.  
    83.     End Sub
    84.  
    85.     Public Sub AddBitParam(ByVal pName As String, ByVal pValue As Boolean)
    86.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.Bit)
    87.         myParm.Value = pValue
    88.  
    89.     End Sub
    90.  
    91.     Public Sub AddStrParam(ByVal pName As String, ByVal pValue As String, ByVal pLen As Integer)
    92.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.NVarChar, pLen)
    93.         myParm.Value = pValue
    94.  
    95.     End Sub
    96.  
    97.     Public Sub AddIntOutParam(ByVal pName As String)
    98.         Dim myParm As SqlParameter = adoCmd.Parameters.Add(pName, SqlDbType.Int)
    99.         myParm.Direction = ParameterDirection.Output
    100.  
    101.  
    102.     End Sub
    103.     Public Sub ClearCmdParam()
    104.         adoCmd.Parameters.Clear()
    105.     End Sub
    106.  
    107.     'DataReader - execute query that returns rows
    108.     Public Function ExecuteQ(ByVal cmdTxt As String) As SqlDataReader
    109.  
    110.         adoCmd.CommandText = cmdTxt
    111.         adoDR = adoCmd.ExecuteReader
    112.         ExecuteQ = adoDR
    113.  
    114.     End Function
    115.  
    116.     'DataReader - execute sql (non query) that does not return rows
    117.     Public Function ExecuteNQ(ByVal cmdTxt As String) As Integer
    118.  
    119.         adoCmd.CommandText = cmdTxt
    120.         rows = adoCmd.ExecuteNonQuery
    121.         ExecuteNQ = rows
    122.  
    123.     End Function
    124.  
    125.     'DataReader - execute scalar query - returns 1 value
    126.     Public Function ExecuteSc(ByVal cmdTxt As String) As Object
    127.  
    128.         adoCmd.CommandText = cmdTxt
    129.         ExecuteSc = adoCmd.ExecuteScalar
    130.  
    131.     End Function
    132.  
    133.     'DataSet - execute query that returns a data set
    134.     Public Function ExecuteDS(ByVal cmdTxt As String) As DataSet
    135.  
    136.         adoCmd.CommandText = cmdTxt
    137.         adoDA.SelectCommand = adoCmd
    138.         adoDA.Fill(adoDS, "SQLDS")
    139.  
    140.         rows = adoDS.Tables(0).Rows.Count
    141.         cols = adoDS.Tables(0).Columns.Count
    142.  
    143.         ExecuteDS = adoDS
    144.  
    145.     End Function
    146.  
    147.     'Insert performing an insert and retrieving 1 output parameter
    148.     Public Function InsertWithReturn(ByVal cmdTxt As String, ByVal pName As String) As Integer
    149.  
    150.         adoCmd.CommandText = cmdTxt
    151.         adoCmd.ExecuteNonQuery()
    152.         InsertWithReturn = Convert.ToInt32(adoCmd.Parameters(pName).Value)
    153.  
    154.     End Function
    155.  
    156.     Public Sub CleanUp()
    157.  
    158.         If Not adoDR Is Nothing Then
    159.             If Not adoDR.IsClosed Then
    160.                 adoDR.Close()
    161.             End If
    162.         End If
    163.         adoCon.Close()
    164.  
    165.         adoDA = Nothing
    166.         adoDS = Nothing
    167.         adoDR = Nothing
    168.         adoCon = Nothing
    169.         adoCmd = Nothing
    170.     End Sub
    171.  
    172. End Class

  6. #6
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    592

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Please check this article, you might find it useful.
    Also as mentioned you should configure the Application for debugging.

    To enable debugging, add a compilation element to the site's root Web.config file, and then set its debug attribute to true.

    vb Code:
    1. <configuration>
    2.   <system.web>
    3.     <compilation debug="true">
    4.       <!-- etc. -->
    5.     </compilation>
    6.   </system.web>
    7. <configuration>

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Yeah my debug was always set to true.... looked at the msdn link, didn't really address my problem. Right now I have the timeout set to 96000 so I don't receive an error, but sometimes it will take almost 3 full minutes for my page to display 5 records.

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    scratch my previous post... even after setting the timeout of the scriptmanager to 96000 I got an error in my serverside code now...

    Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Ok well, I am thinking it is the stored proc now... I took all of the AJAX out and ran it on a plain aspx page and it seems to be having the same behavour. So it's either the proc or the connection to the db.

    Gonna mark this resolved as it doesn't seem to be anything to do with ASP.NET. :P

  10. #10
    Fanatic Member
    Join Date
    Feb 2006
    Posts
    592

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    If you add some Try Catch statements to the XSQL class you should get the precise indicators for the exception. i.e. missing parameter or such. Try Catch into the BindGrid() Sub is actually pretty useless in your situation.
    Regards

  11. #11
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    OK, so if you've narrowed it down to the DB, then what does the SP look like? We could help with that too.

  12. #12

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    Code:
    CREATE PROC USP_GetCM
    	@Project	VARCHAR(20),
    	@StDate		DATETIME,
    	@EndDate 	DATETIME
    AS
    BEGIN
    
    	If @Project = '' Or @Project IS NULL
    		SELECT @Project = "%"
    
    	If @Stdate IS NULL
    		SELECT @Stdate  = "1900-01-01"
    	If @Enddate IS NULL or @Enddate = "1900-01-01"
    		SELECT @Enddate = GETDATE()
    
    	SELECT  MainProject, BillTask, invoice, InvoiceDate, Description, footer
    	FROM 	CMTable
    	WHERE 	InvoiceDate BETWEEN @Stdate AND @Enddate
    	AND	MainProject LIKE @Project
    	AND	invoice <> "<Draft>"
    	AND	
    	(		Description like '%credit%'
    		OR 	description like '%applied%'
    		OR 	description like '%apply%'
    		--OR 	description like '%inv%'
    
    		OR 	footer like '%credit%'
    		OR 	footer like '%applied%'
    		OR 	footer like '%apply%'
    		--OR 	footer like '%inv%'
    	)
    
    	ORDER BY MainProject, BillTask, invoice
    
    END



    GO

  13. #13
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    I think the problem might be with all the LIKE clauses in there. Try taking the SELECT and the FROM together with just the invoicedate clause to see how long that takes. You can also do Ctrl+L to see the execution plan and what's taking the most time/processing cycles.

    Why are you having to perform so many likes on the description? If they are going to be one of four specific text fields, then you should make them int fields and map the ints to another table that contains those values. In other words, it's like an enumeration.

  14. #14

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    I am not even familiar with the actual DB that this is querying. The proc was made by a previous developer, I was just told to make a new interface for it. If it is the stored proc, wouldn't the performance be the same everytime it's run? As of now it gets better and better each time.

  15. #15
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: [RESOLVED] [2005] Sys.WebForms.pageRequestManager TimeoutException : the server request timed ou

    The execution plan gets cached so it should get faster compared to the first time. But if you're experiencing a timeout, there must be something in the SP that's causing it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width