SQL Timeout when initially loading ASP.NET web app

Last post 06-25-2007 3:28 PM by mase. 7 replies.

Sort Posts:

  • SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 3:41 PM
    • Loading...
    • mase
    • Joined on 07-18-2006, 3:52 PM
    • San Francisco
    • Posts 54

    Hello,

    We've built a new large ASP.NET web application. On our staging servers there are no timeout issues or connectivity problems. When we moved to the production server, which is a MUCH faster server machine with 2-dual core CPU's, issues started coming up. What is happening is there is a SQL timeout issue, usually only on the first load of the page. After it loads once, it doesn't seem as slow or have as many time-out issues.

    I know the connection string is correct, as I am able to connect sometimes but not others. The Max Connections is set to unlimited. We have our normal live-website still running in parallel at both the Web & DB servers, but the CPU on both servers are as normal as ever. We are only 2-3 people testing and connecting to the new site while the current site is still live and in use.

    Does anyone have any ideas as to why I am able to connect to the server sometimes and other times not at all? I am certain it's not an issue with a bad query as these procedures run very fast when tested in production through Query Analyzer. I would love to post a stack trace to help track down the error, but it hasn't come up again and I'm not sure how to reproduce it on demand.

    * Mase *
  • Re: SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 4:40 PM
    • Loading...
    • Bruce L
    • Joined on 02-08-2007, 6:53 PM
    • Posts 884

    What is the exact error you are getting?

    Is it a pooled connection error or a simple SQL timeout?

    Bruce
    DiscountASP.NET: Developer Ready ASP.NET Web Hosting
    - Microsoft Gold Certified Partner
    - Voted 2008, 2007, 2006 & 2005 Best ASP.NET Web Hosting by asp.netPRO Magazine
  • Re: SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 5:38 PM
    • Loading...
    • mase
    • Joined on 07-18-2006, 3:52 PM
    • San Francisco
    • Posts 54

    Here is the stack trace from our error logs. Looks as though I'm not logging the exact message, which I've just added to the logs.  Pretty sure it was a time out.

    Another thing to mention is that we are using Lhotka's CSLA persistence framework for our business objects.  The only trace of this in the stack below is the DataPortal_Fetch() call.

     

    An exception of type 'System.Data.SqlClient.SqlException' was caught.
    Stack Trace:
       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.ExecuteReader()
       at MyApp.BusinessObjects.EventInfoList.DataPortal_Fetch(UserCriteria criteria) in C:\WebFolder\BusinessObjects\Objects\EventInfoList.cs:line 1069

    * Mase *
  • Re: SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 6:25 PM
    • Loading...
    • Bruce L
    • Joined on 02-08-2007, 6:53 PM
    • Posts 884

    Hmm.. This error doesn't give much detail.  It doesn't even say it receive a timeout.

    Try run this on your SQL server when you try to load the page

    "sp_who2 'active'" w/o the quote. 

    See if you see the connection and whether it is blocked.

    Bruce
    DiscountASP.NET: Developer Ready ASP.NET Web Hosting
    - Microsoft Gold Certified Partner
    - Voted 2008, 2007, 2006 & 2005 Best ASP.NET Web Hosting by asp.netPRO Magazine
  • Re: SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 7:17 PM
    • Loading...
    • mase
    • Joined on 07-18-2006, 3:52 PM
    • San Francisco
    • Posts 54

     OK, a few new things to add.  I have not run the query you sent me yet.  But here is the exact error and stack trace below.  Also, the error (usually) only occurs when a new session is started in a new in a new browser window. Once the page loads properly the first time, then it's not an issue. This is quite boggling, regardless of whether the session is new or old, shouldn't the database connection work exactly the same way?

     

    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 (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]
    System.Data.SqlClient.SqlConnection.OnError
    (SqlException exception, Boolean breakConnection) +857242
    System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734854
    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning System.Data.SqlClient.TdsParser\u003cWBR\>.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838\n\u003cbr\> System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo) +807499\u003cbr\> System.Data.SqlClient.TdsParser\u003cWBR\>.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1537\n\u003cbr\> System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.ConsumeMetaData() +31\u003cbr\> System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.get_MetaData() +62\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297\n\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132\n\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.ExecuteReader(CommandBehavior behavior, String method) +122\n\u003cbr\> System.Data.SqlClient.SqlComman\u003cWBR\>d.ExecuteReader() +84\u003cbr\> MyApp.BusinessObjects\u003cWBR\>.EventInfoList.DataPortal_Fetch(UserCriteria criteria) in C:\\WebFolder\\BusinessObject\u003cWBR\>s\\Objects\\EventInfoList.cs:1069\u003cbr\>\u003cbr\>[CallMethodException: DataPortal_Fetch method call failed]\n\u003cbr\> Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in C:\\WebFolder\\Csla\\DataPorta\u003cWBR\>l\\MethodCaller.cs:118\u003cbr\> Csla.Server.SimpleDataPortal\u003cWBR\>.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\\WebFolder\\Csla\\DataPorta\u003cWBR\>l\\Server\\SimpleDataPortal.cs\u003cWBR\>:109\n\u003cbr\>",1] ); //-->
    (TdsParserStateObject stateObj) +188
    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838

    System.Data.SqlClient.SqlDataReader.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo) +807499
    System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1537

    System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
    System.Data.SqlClient.SqlDataReader.get_MetaData() +62
    System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297

    System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132

    System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
    System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +122

    System.Data.SqlClient.SqlCommand.ExecuteReader() +84
    MyApp.BusinessObjects.EventInfoList.DataPortal_Fetch(UserCriteria criteria) in C:\MyApp\BusinessObjects\Objects\EventInfoList.cs:1069

    [CallMethodException: DataPortal_Fetch method call failed]

    Csla.MethodCaller.CallMethod(Object obj, MethodInfo info, Object[] parameters) in C:\MyApp\Csla\DataPortal\MethodCaller.cs:118
    Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context) in C:\MyApp\Csla\DataPortal\Server\SimpleDataPortal.cs:109

    [DataPortalException: DataPortal.Fetch failed (System.Data.SqlClient.SqlExcept\u003cWBR\>ion: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.\u003cbr\> at System.Data.SqlClient.SqlConnec\u003cWBR\>tion.OnError\n(SqlException exception, Boolean breakConnection)\u003cbr\> at System.Data.SqlClient.SqlIntern\u003cWBR\>alConnection.OnError(SqlException exception, Boolean breakConnection)\u003cbr\> at System.Data.SqlClient.TdsParser\u003cWBR\>.ThrowExceptionAndWarning\n(TdsParserStateObject stateObj)\u003cbr\> at System.Data.SqlClient.TdsParser\u003cWBR\>.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\n\u003cbr\> at System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo)\u003cbr\> at System.Data.SqlClient.TdsParser\u003cWBR\>.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)\n\u003cbr\> at System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.ConsumeMetaData()\u003cbr\> at System.Data.SqlClient.SqlDataRe\u003cWBR\>ader.get_MetaData()\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)\n\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)\n\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.ExecuteReader(CommandBehavior behavior, String method)\n\u003cbr\> at System.Data.SqlClient.SqlComman\u003cWBR\>d.ExecuteReader()\u003cbr\> at MyApp.BusinessObjects\u003cWBR\>.EventInfoList.DataPortal_Fetch(UserCriteria criteria) in C:\\WebFolder\\BusinessObject",1] ); //-->
    [DataPortalException: DataPortal.Fetch failed (System.Data.SqlClient.SqlException: 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.SetMetaData(_SqlMetaDataSet metaData, Boolean moreInfo)
    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.ExecuteReader()
    at MyApp.BusinessObjects.EventInfoList.DataPortal_Fetch(UserCriteria criteria) in C:\WebFolder\BusinessObjects\\Objects\\EventInfoList.cs:line 1069)]\u003cbr\>\n Csla.DataPortal.Fetch(Type objectType, Object criteria) in C:\\WebFolder\\Csla\\DataPorta\u003cWBR\>l\\Client\\DataPortal.cs:192\u003cbr\> Csla.DataPortal.Fetch(Object criteria) in C:\\WebFolder\\Csla\\DataPorta\u003cWBR\>l\\Client\\DataPortal.cs:140\n\u003cbr\> MyApp.BusinessObjects\u003cWBR\>.EventInfoList.FetchByUserFavor\u003cWBR\>ites(Int32 userID, DateTime startDate, DateTime endDate, String zip, Int32 radius, Int32 count) in C:\\WebFolder\\BusinessObject\u003cWBR\>s\\Objects\\EventInfoList.cs:283\n\u003cbr\> MyApp.BusinessObjects\u003cWBR\>.EventInfoList.FetchByUserFavor\u003cWBR\>ites(Int32 userID, DateTime startDate, DateTime endDate, Int32 count) in C:\\WebFolder\\BusinessObject\u003cWBR\>s\\Extended\\EventInfoList.cs:32\u003cbr\> MyApp.BusinessObjects\u003cWBR\>.EventInfoList.FetchOURFavo\u003cWBR\>rites\n(DateTime startDate, DateTime endDate, Int32 count) in C:\\WebFolder\\BusinessObject\u003cWBR\>s\\Extended\\EventInfoList.cs:67\u003cbr\> MyApp.BusinessObjects\u003cWBR\>.EventInfoList.FetchFeaturedSho\u003cWBR\>ws(UserSession user) in C:\\WebFolder\\BusinessObject\u003cWBR\>s\\Extended\\EventInfoList.cs:15\n\u003cbr\> Controls_ShowList.DataBind() +62\u003cbr\> System.Web.UI.Control.DataBindC\u003cWBR\>hildren() +216\u003cbr\> System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216\u003cbr\> System.Web.UI.Control.DataBind() +12\u003cbr\> System.Web.UI.Control.DataBindC\u003cWBR\>hildren\n() +216\u003cbr\> System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216\u003cbr\> System.Web.UI.Control.DataBind() +12\u003cbr\> System.Web.UI.Control.DataBindC\u003cWBR\>hildren() +216\u003cbr\> System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216\n\u003cbr\> System.Web.UI.Control.DataBind() +12\u003cbr\> MyApp_MasterPage.Page_Load\u003cWBR\>(Object sender, EventArgs e) +326\u003cbr\> System.Web.Util.CalliHelper\u003cWBR\>.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15\u003cbr\> \nSystem.Web.Util.CalliEventHandl\u003cWBR\>erDelegateProxy.Callback(Object sender, EventArgs e) +34\u003cbr\> System.Web.UI.Control.OnLoad(EventArgs e) +99\u003cbr\> System.Web.UI.Control.LoadRecur\u003cWBR\>sive() +47\u003cbr\> System.Web.UI.Control.LoadRecur",1] ); //-->s\Objects\EventInfoList.cs:line 1069)]

    Csla.DataPortal.Fetch(Type objectType, Object criteria) in C:\WebFoler\Csla\DataPortal\Client\DataPortal.cs:192
    Csla.DataPortal.Fetch(Object criteria) in C:\WebFolderCsla\DataPortal\Client\DataPortal.cs:140

    MyApp.BusinessObjects.EventInfoList.FetchByUserFavorites(Int32 userID, DateTime startDate, DateTime endDate, String zip, Int32 radius, Int32 count) in C:\WebFolder\BusinessObjects\Objects\EventInfoList.cs:283

    MyApp.BusinessObjects.EventInfoList.FetchByUserFavorites(Int32 userID, DateTime startDate, DateTime endDate, Int32 count) in C:\WebFolder\BusinessObjects\Extended\EventInfoList.cs:32
    MyApp.BusinessObjects.EventInfoList.FetchMyAppFavorites
    (DateTime startDate, DateTime endDate, Int32 count) in C:\WebFolder\BusinessObjects\Extended\EventInfoList.cs:67
    MyApp.BusinessObjects.EventInfoList.FetchFeaturedShows(UserSession user) in C:\WebFolder\BusinessObjects\Extended\EventInfoList.cs:15

    Controls_ShowList.DataBind() +62
    System.Web.UI.Control.DataBindChildren() +216
    System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216
    System.Web.UI.Control.DataBind() +12
    System.Web.UI.Control.DataBindChildren
    () +216
    System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216
    System.Web.UI.Control.DataBind() +12
    System.Web.UI.Control.DataBindChildren() +216
    System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216

    System.Web.UI.Control.DataBind() +12
    MyApp_MasterPage.Page_Load(Object sender, EventArgs e) +326
    System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15

    System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
    System.Web.UI.Control.OnLoad(EventArgs e) +99
    System.Web.UI.Control.LoadRecursive() +47
    System.Web.UI.Control.LoadRecursive\n() +131\u003cbr\> System.Web.UI.Page.ProcessReque\u003cWBR\>stMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061\u003cbr\>\u003c/pre\>\n\n \u003c/td\>\n \u003c/tr\>\n \u003c/tbody\>\u003c/table\>\n\n \u003cbr\>\n\n \u003chr color\u003d\"silver\" size\u003d\"1\" width\u003d\"100%\"\>\n\n \u003cb\>Version Information:\u003c/b\> Microsoft .NET Framework Version:2.0.50727.42; \u003ca href\u003d\"http://ASP.NET\" target\u003d\"_blank\" onclick\u003d\"return top.js.OpenExtLink(window,event,this)\"\>ASP.NET\u003c/a\> Version:2.0.50727.210\u003c/font\>",1] ); //-->sive
    () +131
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
     

    * Mase *
  • Re: SQL Timeout when initially loading ASP.NET web app

    05-22-2007, 8:58 PM
    Answer
    • Loading...
    • Bruce L
    • Joined on 02-08-2007, 6:53 PM
    • Posts 884

    With this error, it looks like ADO is making connection to the SQL server but the query just timed out.

    I think running the sp_who2 command should give you a better insight as to what the SQL server was doing when you try to load your page.

    Bruce
    DiscountASP.NET: Developer Ready ASP.NET Web Hosting
    - Microsoft Gold Certified Partner
    - Voted 2008, 2007, 2006 & 2005 Best ASP.NET Web Hosting by asp.netPRO Magazine
  • Re: SQL Timeout when initially loading ASP.NET web app

    06-21-2007, 3:30 PM
    • Loading...
    • RobKraft
    • Joined on 02-23-2007, 10:41 PM
    • Posts 6

    We had a similar problem.  Our problem is that we were not disposing our database connections.  If you do not explicitly call .Dispose on your connections; then the SQL Connections will not be released to the pool until Garbage Collection (GC) runs.  We changed our code to explicitly call .Dispose on all of our connections and the problems went away; since the connections were released immediately, subsequent database calls were able to use the connection from the pool.

     We did not .Dispose originally because the examples in the CSLA books do not do so.  However, if you look at them, they are all enclosed in a USING statement.  I now believe that USING not only is to reduce namespace typing; but when the USING block ends; dispose is called immediately.  I plan to test this soon.

  • Re: SQL Timeout when initially loading ASP.NET web app

    06-25-2007, 3:28 PM
    • Loading...
    • mase
    • Joined on 07-18-2006, 3:52 PM
    • San Francisco
    • Posts 54

     Yes, the USING statement quitely closes the object that is inside the using statement upon reaching it's closing curly bracket }. So if your making use of the USING statement (as CSLA does in the examples), disposing connections and commands inside your business objects is not necessary.

    I figured out, after a tumultuous journey of trial-and-error, that it truly was an issue with the database timing out.  However, it was difficult to conclude this since the use of CSLA abstracts the error messages sometimes if not used properly.  If the call to the database was put inside a try..catch, then it would have been easier to determine that there was a time-out occurring at the database end.

    * Mase *
Page 1 of 1 (8 items)
Microsoft Communities
Page view counter