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.
Message: Timeout. Il tempo disponibile è scaduto prima del completamento dell’operazione o il server non risponde.
Stack trace:
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.SqlClient.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.DataQuery`1.
in System.Linq.Queryable.
in SecurDPS.RoleProvider.
in System.Web.Security.
in System.Web.Configuration.
in System.Web.Configuration.
in System.Web.Configuration.
in System.Web.Security.
in System.Web.HttpApplication.
in System.Web.HttpApplication.
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)
Type: System.Data.SqlClient.
Message: Timeout. Il tempo disponibile è scaduto prima del completamento dell’operazione o il server non risponde.
Stack trace:
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.ProviderBase.
in System.Data.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.SqlClient.
in System.Data.Linq.DataQuery`1.
in System.Linq.Queryable.
in SecurDPS.RoleProvider.
in System.Web.Security.
in System.Web.Configuration.
in System.Web.Configuration.
in System.Web.Configuration.
in System.Web.Security.
in System.Web.HttpApplication.
in System.Web.HttpApplication.