PC Review Forums Newsgroups Microsoft DotNet Microsoft ADO .NET Query runs slow from web app, but not from management studio

Reply

Query runs slow from web app, but not from management studio

 
Thread Tools Rate Thread
Old 20-06-2006, 05:30 PM   #1
Jeremy Chapman
Guest
 
Posts: n/a
Default Query runs slow from web app, but not from management studio


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?


  Reply With Quote
Old 20-06-2006, 05:45 PM   #2
W.G. Ryan - MVP
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

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/07...=books&v=glance
http://search.barnesandnoble.com/bo...735622779&itm=1
"Jeremy Chapman" <please@Idontlikespam> wrote in message
news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
> 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?
>



  Reply With Quote
Old 20-06-2006, 06:46 PM   #3
Jeremy Chapman
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

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




"W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
> 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/07...=books&v=glance
> http://search.barnesandnoble.com/bo...735622779&itm=1
> "Jeremy Chapman" <please@Idontlikespam> wrote in message
> news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
>> 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?
>>

>
>



  Reply With Quote
Old 20-06-2006, 08:20 PM   #4
W.G. Ryan - MVP
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

My suggestion is to run Profiler and then run the app. Verify what's being
sent to the server, particularly w/ respect to the parameters.

BTW, as an aside, you can kill the &&reader1.HasRows, the
while(reader1.Read()) has the same effect. However that's not the problem.

by any chance are you using Sql Debugging?

--
Cordially,

W.G. Ryan - MVP
Windows Embedded

Author - MCTS Self-Paced Training Kit (Exam 70-536)
http://www.amazon.com/gp/product/07...=books&v=glance
http://search.barnesandnoble.com/bo...735622779&itm=1
"Jeremy Chapman" <please@Idontlikespam> wrote in message
news:uBUP$FJlGHA.5072@TK2MSFTNGP04.phx.gbl...
> 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
>
>
>
>
> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
>> 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/07...=books&v=glance
>> http://search.barnesandnoble.com/bo...735622779&itm=1
>> "Jeremy Chapman" <please@Idontlikespam> wrote in message
>> news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
>>> 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?
>>>

>>
>>

>
>



  Reply With Quote
Old 20-06-2006, 09:23 PM   #5
Jeremy Chapman
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

Not using sql debugging. Runing profiler won't be easy, as the issue is
occuring on a live server, and our sever group won't let us run profiler
because of performance hits on the server.


"W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
news:e25mf6JlGHA.3924@TK2MSFTNGP03.phx.gbl...
> My suggestion is to run Profiler and then run the app. Verify what's being
> sent to the server, particularly w/ respect to the parameters.
>
> BTW, as an aside, you can kill the &&reader1.HasRows, the
> while(reader1.Read()) has the same effect. However that's not the problem.
>
> by any chance are you using Sql Debugging?
>
> --
> Cordially,
>
> W.G. Ryan - MVP
> Windows Embedded
>
> Author - MCTS Self-Paced Training Kit (Exam 70-536)
> http://www.amazon.com/gp/product/07...=books&v=glance
> http://search.barnesandnoble.com/bo...735622779&itm=1
> "Jeremy Chapman" <please@Idontlikespam> wrote in message
> news:uBUP$FJlGHA.5072@TK2MSFTNGP04.phx.gbl...
>> 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
>>
>>
>>
>>
>> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
>> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
>>> 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/07...=books&v=glance
>>> http://search.barnesandnoble.com/bo...735622779&itm=1
>>> "Jeremy Chapman" <please@Idontlikespam> wrote in message
>>> news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
>>>> 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?
>>>>
>>>
>>>

>>
>>

>
>



  Reply With Quote
Old 21-06-2006, 02:51 PM   #6
W.G. Ryan - MVP
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

Can you attach or copy a set of records to another server and change your
connection string? That would keep it off the server but should give you a
good idea about what's happening.

--
Cordially,

W.G. Ryan - MVP
Windows Embedded

Author - MCTS Self-Paced Training Kit (Exam 70-536)
http://www.amazon.com/gp/product/07...=books&v=glance
http://search.barnesandnoble.com/bo...735622779&itm=1
"Jeremy Chapman" <please@Idontlikespam> wrote in message
news:uWnjcdKlGHA.4872@TK2MSFTNGP04.phx.gbl...
> Not using sql debugging. Runing profiler won't be easy, as the issue is
> occuring on a live server, and our sever group won't let us run profiler
> because of performance hits on the server.
>
>
> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
> news:e25mf6JlGHA.3924@TK2MSFTNGP03.phx.gbl...
>> My suggestion is to run Profiler and then run the app. Verify what's
>> being sent to the server, particularly w/ respect to the parameters.
>>
>> BTW, as an aside, you can kill the &&reader1.HasRows, the
>> while(reader1.Read()) has the same effect. However that's not the
>> problem.
>>
>> by any chance are you using Sql Debugging?
>>
>> --
>> Cordially,
>>
>> W.G. Ryan - MVP
>> Windows Embedded
>>
>> Author - MCTS Self-Paced Training Kit (Exam 70-536)
>> http://www.amazon.com/gp/product/07...=books&v=glance
>> http://search.barnesandnoble.com/bo...735622779&itm=1
>> "Jeremy Chapman" <please@Idontlikespam> wrote in message
>> news:uBUP$FJlGHA.5072@TK2MSFTNGP04.phx.gbl...
>>> 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
>>>
>>>
>>>
>>>
>>> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
>>> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
>>>> 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/07...=books&v=glance
>>>> http://search.barnesandnoble.com/bo...735622779&itm=1
>>>> "Jeremy Chapman" <please@Idontlikespam> wrote in message
>>>> news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
>>>>> 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?
>>>>>
>>>>
>>>>
>>>
>>>

>>
>>

>
>



  Reply With Quote
Old 26-06-2006, 04:34 PM   #7
srijan321@gmail.com
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

Hi,
Did you find the solution? I have the same kind of problem. we are
using Microsoft application blocks to connect to db, and its getting
timeout.

Thanks
Srijan


Jeremy Chapman wrote:
> 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
>
>
>
>
> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
> > 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/07...=books&v=glance
> > http://search.barnesandnoble.com/bo...735622779&itm=1
> > "Jeremy Chapman" <please@Idontlikespam> wrote in message
> > news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
> >> 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?
> >>

> >
> >


  Reply With Quote
Old 26-06-2006, 04:34 PM   #8
srijan321@gmail.com
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

Hi,
Did you find the solution? I have the same kind of problem. we are
using Microsoft application blocks to connect to db, and its getting
timeout.

Thanks
Srijan


Jeremy Chapman wrote:
> 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
>
>
>
>
> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
> > 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/07...=books&v=glance
> > http://search.barnesandnoble.com/bo...735622779&itm=1
> > "Jeremy Chapman" <please@Idontlikespam> wrote in message
> > news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
> >> 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?
> >>

> >
> >


  Reply With Quote
Old 26-06-2006, 04:59 PM   #9
Jeremy Chapman
Guest
 
Posts: n/a
Default Re: Query runs slow from web app, but not from management studio

Not yet. Hopefully I can do some more investigation later this week.


<srijan321@gmail.com> wrote in message
news:1151336068.056905.232300@p79g2000cwp.googlegroups.com...
> Hi,
> Did you find the solution? I have the same kind of problem. we are
> using Microsoft application blocks to connect to db, and its getting
> timeout.
>
> Thanks
> Srijan
>
>
> Jeremy Chapman wrote:
>> 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
>>
>>
>>
>>
>> "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message
>> news:%23f1C%23jIlGHA.1320@TK2MSFTNGP04.phx.gbl...
>> > 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/07...=books&v=glance
>> > http://search.barnesandnoble.com/bo...735622779&itm=1
>> > "Jeremy Chapman" <please@Idontlikespam> wrote in message
>> > news:%23MpqMbIlGHA.2280@TK2MSFTNGP02.phx.gbl...
>> >> 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?
>> >>
>> >
>> >

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off