Hi Mingqing,
I would like to add some more info, which could be helpful. I installed
Visual Studio.NET 2003 on a Windows 2003 Server machine and copied the
source code of the problematic project. It now runs on this machine as well,
connecting to the same Virtual SQL Server. I did some testing and noticed a
strange thing. Once a "Connection Timeout" error occurs it is impossible to
connect by typing the URL in the IE address bar. However, if I start the
Project from Visual Studio(runs the same .aspx page) connection is
established and some parts of the application work and other parts don't.
Once the SQL Server is restarted all parts of the application work fine,
both if started directly from IE or started from Visual Studio.
The connection string used is like this:
MES_CONNECTION_STRING = "data source= SERVER;Initial Catalog= TESTDB;User
ID=test;Password=ABC123;Trusted_connection=no;Pers ist Security Info=True;Max
Pool Size=500;Connection Lifetime=10;"
Below is the code(it is in a .vb page) where the error occurs(it fails with
timeout error on the line with "retval = cmd.ExecuteScalar()" ):
Public Overloads Shared Function ExecuteScalar(ByVal connection As
SqlConnection, _
ByVal commandType As CommandType, _
ByVal commandText As String, _
ByVal ParamArray commandParameters() As SqlParameter) As Object
'create a command and prepare it for execution
Dim cmd As New SqlCommand
Dim retval As Object
#If TRACE Then
Dim datStartTime As Date
datStartTime = Now
#End If
CustomFunctions.Log("Query -> " & commandText)
PrepareCommand(cmd, connection, CType(Nothing, SqlTransaction), commandType,
commandText, commandParameters)
'execute the command & return the results
retval = cmd.ExecuteScalar() '!!!!! FAILS HERE
'detach the SqlParameters from the command object, so they can be used again
cmd.Parameters.Clear()
#If TRACE Then
If m_blnGlobalTraceActive = True Then
GlobalTrace(commandText, Now.Subtract(datStartTime).TotalSeconds)
End If
#End If
Return retval
End Function 'ExecuteScalar
""Mingqing Cheng [MSFT]"" <v-mingqc (AT) online (DOT) microsoft.com> wrote
Quote:
Hi Sezgin,
Once the "Connection Timeout" Error occurs, please use sp_who2 to check
whether there is any invisiable connection keep alive in the SQL Server
from problematic application. I guess there must be one.
Moreover, I will try to see whether it is possible to pick up an ASP.NET
Support Professional to give you some instructions on ASP.NET side
Thank you for your patience and corperation. If you have any questions or
concerns, don't hesitate to let me know. We are here to be of assistance!
Sincerely yours,
Mingqing Cheng
Online Partner Support Specialist
Partner Support Group
Microsoft Global Technical Support Center
---------------------------------------------------------------
Introduction to Yukon! - http://www.microsoft.com/sql/yukon
This posting is provided "as is" with no warranties and confers no rights.
Please reply to newsgroups only, many thanks! |