Click here to Skip to main content
12,953,544 members (52,051 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Dear All, I am having an issue with an aspx where it takes too much (more than 1 min) to execute a page as it only takes 2 second in sql server to execute the same query where i am calling from aspx page.

I didn't understand why the aspx page takes too much time?

and below is the event log
An unhandled exception has occurred.
11/10/2012 1:43:27 PM
11/10/2012 9:13:27 AM

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) at System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at System.Web.UI.WebControls.GridView.DataBind() at System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() at System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Posted 9-Nov-12 22:13pm
Updated 9-Nov-12 22:30pm
aspnet_regiis -i 10-Nov-12 4:39am
And where is the code? Did you debug to check where it takes more time to execute. ???
Nelek 10-Nov-12 7:04am
Op answered you in comment below
aspnet_regiis -i 10-Nov-12 10:05am
@Nelek.. Are you sure it is an 'answer' ?
Nelek 10-Nov-12 11:15am
Well, yours was the only comment and he told thanks. I supposed he wanted to speak with you. If what he says makes sense or can be considered as "answer"... is free to your imagination ;P
Abdul Rahman Hamidy 10-Nov-12 7:46am
Thanks, there is no error, a very simple page (GridView + SqlDataSource), calling procedure in sql server. and it takes long time to execute page but a second in sql server 2k5.
aspnet_regiis -i 10-Nov-12 9:59am
Sorry..But I am not that intelligent to guess what might be wrong without seeing the code..There are thousands of ways to get the code screwed and I can't guess which might be your favourite....
Nelek 10-Nov-12 11:17am
:laugh::laugh: Good point your second affirmation.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Wellll, it's bloody obvious from the exception message you got that your code cannot connect to the SQL Server. Without seeing your code and the connection string you used, it's impossible for anyone to tell you how to fix it.
Abdul Rahman Hamidy 10-Nov-12 23:34pm
Thanks, I run sql profiler while executing the page and i did find the procedure in profiler. I copied the procedure from profiler and run it in SSMS (Management Studio) and it runs in a second but in page it gives that exception.

below is the connection string in config file in side tag. (other pages are running correctly)

name="ConnString" connectionstring="Server=something; Initial Catalog=DBName; User ID=User; Password=password; Connection TimeOut=180;" providername="System.Data.SqlClient"

and also the sqlDataSource in the page

<asp:SqlDataSource ID="sqlgvCDCDetail" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnString %>"
SelectCommand="GetCDCDetail" SelectCommandType="StoredProcedure">
<asp:SessionParameter DefaultValue="0" Name="rID"
SessionField="RegionID" Type="Byte" />
<asp:SessionParameter DefaultValue="0" Name="pID"
SessionField="ProvinceID" Type="Byte" />
<asp:SessionParameter DefaultValue="0" Name="dID"
SessionField="DistrictID" Type="Int16" />
<asp:SessionParameter DefaultValue="0" Name="bgTID" SessionField="BgTypeID"
Type="Byte" />
<asp:SessionParameter Name="fID"
SessionField="FPID" Type="Byte" />
<asp:SessionParameter Name="usrName" SessionField="UserName"
Type="String" />
Dave Kreskowiak 11-Nov-12 9:56am
The other pages that are running OK, are they using the exactly same connection string??

It takes so long to run this page because the connection timeout is 180 seconds. I'm guessing that your page takes 3 minutes to give you the failure message you posted.

You might want to verify the connection string. If those are the unaltered parameters, you've got them very wrong.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

solved. clear the cache and everything went smooth. (Just to close thread)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,930

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 16 Dec 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100