views:

14

answers:

0

Hey,

I have a model-view-controller based web application. When the application starts up, I first call a clearup stored procedure. This basically removes any rows from the database which are now irrelevant. For example if the company had deleted a category but I had missed out the line to delete all products within this category, this sproc goes through the products table and deletes those where the category does not exist anymore. This prevents errors occurring later in the application.

However it is this line which seems to cause a "Timeout Expired" message. It seems the message occurs only when Visual Web Developer starts the "internal web server" (for lack of a better term). If I rebuild the project then reload the page it works fine. I have never seen this occur on the live or test sites. Has anyone ever come across this before? I know its not a major issue and I have found a way to solve it by rebuilding the solution - but its beginning to bug me. Any assistance would be much appreciated.

The stacktrace I get is this:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849015
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) +527
   System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) +359
   System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket() +88
   System.Data.SqlClient.TdsParserStateObject.ReadBuffer() +39
   System.Data.SqlClient.TdsParserStateObject.ReadByte() +20
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +107
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +35
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +144
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4863459
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
   System.Data.SqlClient.SqlConnection.Open() +122
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDbCommand(DbCommand command, DataSourceOperation operation) +386
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteDelete(IDictionary keys, IDictionary oldValues) +303
   System.Web.UI.WebControls.SqlDataSource.Delete() +18
   Heritage.Web.Content.SiteContent..cctor() in C:\DB\My Dropbox\Website\V2.0.0.4\Code\Classes\Core\SiteContent.vb:88

[TypeInitializationException: The type initializer for 'Heritage.Web.Content.SiteContent' threw an exception.]
   Heritage.Web.Content.SiteContent.ReplaceHtml(String str) in C:\DB\My Dropbox\Website\V2.0.0.4\Code\Classes\Core\SiteContent.vb:656
   Heritage.Web.Pages.Administration.Page.Page_PreInit(Object sender, EventArgs e) in C:\DB\My Dropbox\Website\V2.0.0.4\Code\Classes\CustomPages\Administration\Page.vb:53
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Page.OnPreInit(EventArgs e) +8703038
   System.Web.UI.Page.PerformPreInit() +31
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282

It may be the fact that I am calling it in the page preinit method. But I have the theme and masterpage for the customer- and admin- frontends set in the database, and the only place I can set the theme is in the @page tag or the page preinit function. If this is the case then I dont know why it would not work once on Dev (each time VWD is started up) and it works fine on Live and Test.

Regards,

Richard

PS sorry if this is on the wrong site - I thought it belongs here because it is one specific line of code where it is occurring.