I've never knowingly seen a connection timeout, so I don't know what the
exception looks like. I've Included the timeout information below.
There is call to Read() in a while loop after the ExecuteReader call,
but the exception gets thrown on the ExecuteReader call.
reader1 = SqlHelper.ExecuteReader(ConnectionString.Instance.Value,
"GetMeasurementsByUser", new object[] { systemUserId, metricId });
ArrayList list1 = new ArrayList();
while (reader1.Read() && reader1.HasRows)
{
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Timeout expired.
The timeout period elapsed prior to completion of the operation or the
server is not responding.
Source Error:
An unhandled exception was generated during the execution of the current
web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.
Stack Trace:
[SqlException: Timeout expired. The timeout period elapsed prior to
completion of the operation or the server is not responding.]
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
cmdBehavior, RunBehavior runBehavior, Boolean returnStream) +742
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
behavior) +45
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(SqlConnection
connection, SqlTransaction transaction, CommandType commandType, String
commandText, SqlParameter[] commandParameters, SqlConnectionOwnership
connectionOwnership) +351
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String
connectionString, CommandType commandType, String commandText,
SqlParameter[] commandParameters) +114
Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String
connectionString, String spName, Object[] parameterValues) +84
ExecuteReader doesn't complete the process. You have to process the
stream by calling .Read() until there isn't any more data left,
typically accopmlished by using a while loop.
However with the timeouts, are the command timeouts or connection
timeouts?
--
Cordially,
W.G. Ryan - MVP
Windows Embedded
Author - MCTS Self-Paced Training Kit (Exam 70-536)
http://www.amazon.com/gp/product/0735622779/ref=pd_ts_b_6/103-6803568-2524652?n=5&s=books&v=glance
http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&isbn=0735622779&itm=1
This is odd, when I run a stored procedure from query analyzer or sql
server management studio my results return within about 3 seconds.
but when I run the same query from my web app I get sql timeouts
sometimes and other times it's just plain slow. I've verified that
both are using the same sql server and login credentials.
I'm using the Microsoft.ApplicationBlocks.Data assembly (which I don't
think is the issue) here is the line of code that makes the call:
SqlHelper.ExecuteReader(ConnectionString.Instance.Value,
"GetMeasurementsByUser", new object[] { systemUserId, metricId });
Any ideas?