{ Dev Farm }

Web & Windows Development

Fixing Randoms System.Data.SqlClient.SqlException Timeout

| 0 commenti

If you are fighting against randoms System.Data.SqlClient.SqlException Timeout and you’re using sql express you can try to disable the Auto Close feature:

Right click on the database -> Properties

Those are a couple of errors I was having:

Excpetion:
Type: System.Data.SqlClient.

SqlException
Message: Timeout. Il tempo disponibile è scaduto prima del completamento dell’operazione o il server non risponde.
Stack trace:
in System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
in System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
in System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
in System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj)
in System.Data.SqlClient.TdsParserStateObject.ReadNetworkPacket()
in System.Data.SqlClient.TdsParserStateObject.ReadByte()
in System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
in System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
in System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
in System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
in System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
in System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
in System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
in System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
in System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
in System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
in System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
in System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
in System.Data.SqlClient.SqlConnection.Open()
in System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
in System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
in System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
in System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
in System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression)
in System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
in SecurDPS.RoleProvider.GetRolesForUser(String username) in xxxxxxxxxxxxx.cs:riga 20
in System.Web.Security.RolePrincipal.IsInRole(String role)
in System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal)
in System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb)
in System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb)
in System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs)
in System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
in System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Excpetion:
Type: System.Data.SqlClient.

SqlException
Message: Timeout. Il tempo disponibile è scaduto prima del completamento dell’operazione o il server non risponde.
Stack trace:
in System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
in System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
in System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
in System.Data.SqlClient.SqlConnection.Open()
in System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
in System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
in System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
in System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query)
in System.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute(Expression expression)
in System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
in SecurDPS.RoleProvider.GetRolesForUser(String username) in xxxxxxxxxxxxx.cs:riga 20
in System.Web.Security.RolePrincipal.IsInRole(String role)
in System.Web.Configuration.AuthorizationRule.IsTheUserInAnyRole(StringCollection roles, IPrincipal principal)
in System.Web.Configuration.AuthorizationRule.IsUserAllowed(IPrincipal user, String verb)
in System.Web.Configuration.AuthorizationRuleCollection.IsUserAllowed(IPrincipal user, String verb)
in System.Web.Security.UrlAuthorizationModule.OnEnter(Object source, EventArgs eventArgs)
in System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
in System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Lascia un commento

I campi obbligatori sono contrassegnati con *.