You receive a "Timeout expired" error message when you run a Visual Studio .NET 2003 application| Article ID | : | 830118 | | Last Review | : | April 23, 2007 | | Revision | : | 1.4 |
SYMPTOMSWhen you enable the SQL Server
debugging feature in Microsoft Visual Studio .NET 2003, and then you run an application, you receive the following
error message: Timeout expired. The timeout period
elapsed prior to obtaining a connection from the pool. This may have occurred
because all pooled connections were in use and max pool size was
reached. Back to the top
CAUSEThe SQLClient Pool runs out of
SqlInternalConnection objects. Back to the top
WORKAROUNDTo work around this problem, use one of the following methods: Method 1Change your project configuration to Release mode. To
do this, follow these steps:
| 1. | In Visual Studio .NET, click Configuration Manager on the Build menu, and then click Release
in the Active Solution Configuration list. | | 2. | On the Debug menu, click
Start to run your application. Notice that you do not receive
the error message that is mentioned in the "Symptoms" section. |
Method 2Change the Debug mode configuration properties of your project. To do this, follow these steps:
| 1. | In Visual Studio .NET, right-click your application in Solution Explorer, and then click Properties. | | 2. | In a Microsoft Visual Basic .NET project, click Debug under Configuration Properties, and then clear SQL Server debugging under
Enable Debuggers.
In a Microsoft Visual C# .NET project, click
Debugging under Configuration Properties, and then set the value of Enable SQL
Debugging under
Debuggers to False. |
Back to the top
STATUS This
behavior is by design. Back to the top
MORE INFORMATION| 1. | Start Visual Studio .NET 2003. | | 2. | On the File menu, point to New, and then click Project. | | 3. | Click Visual Basic Projects or Visual C# Projects under Project Types, and then click Windows Application under Templates. | | 4. | Name the project
SampleApplication. By default, Form1 is
created. | | 5. | Add a button control to Form1. | | 6. | Double-click the button that you added to Form1. | | 7. | Add the following code at the top of the Form1
class:Visual Basic .NETImports System
Imports System.Data.SqlClient
Visual C# .NETusing System;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Windows.Forms; | | 8. | In Visual Basic .NET, add the following code
to the Click event of the Button1 button:Dim iCount As Integer = 1
Try
Do
Dim sqlConn As New _
SqlConnection("Data Source=localhost;trusted_Connection=yes;initial catalog = Northwind")
sqlConn.Open()
Trace.WriteLine("opening connection " & CStr(iCount))
sqlConn.Close()
Trace.WriteLine("closing connection " & CStr(iCount))
sqlConn.Dispose()
Trace.WriteLine("disposing connection " & CStr(iCount))
iCount = iCount + 1
Loop Until iCount > 200
Catch ex As Exception
Trace.WriteLine(ex.ToString)
End TryIn Visual C# .NET, add the following code to the Click
event of the button1 button:int iCount = 1;
try{
while (iCount <= 200){
SqlConnection sqlConn = new SqlConnection("Data Source=localhost;" +
"trusted_Connection=yes;initial catalog = Northwind");
sqlConn.Open();
Trace.WriteLine("opening connection " + iCount.ToString());
sqlConn.Close();
Trace.WriteLine("closing connection " + iCount.ToString());
sqlConn.Dispose();
Trace.WriteLine("disposing connection " + iCount.ToString());
iCount = iCount + 1;
}
}catch(Exception ex){
Trace.WriteLine(ex.Message);
} | | 9. | On the Build menu, click Configuration Manager, and then click Debug in the Active Solution Configuration list. | | 10. | In Solution Explorer, right-click
SampleApplication, and then click
Properties. | | 11. | In a Visual Basic .NET project, click Debug under Configuration Properties, and then click to select SQL Server debugging under
Enable Debuggers.
In a Visual C# .NET project, click
Debugging under Configuration Properties, and then set the value of Enable SQL
Debugging under
Debuggers to True. | | 12. | Click OK to close the
SampleApplication Property Pages dialog box. | | 13. | On the Debug menu, click
Start to run your application. |
Back to the top
REFERENCESFor
more information about pooling in MDAC, visit the following Microsoft Developer
Network (MSDN) Web site: Back to the top
APPLIES TO| • | Microsoft Visual Studio .NET 2003 Enterprise Architect | | • | Microsoft Visual Studio .NET 2003 Enterprise Developer | | • | Microsoft Visual Studio .NET 2003 Professional Edition | | • | Microsoft Visual Studio .NET 2003 Academic Edition |
Back to the top
| Other Support Options- Need More Help?
Contact a Support professional by Email, Online or Phone. - Customer Service
For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more. - Newsgroups
Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.
|
|