我是MVC的新手,所以我使用基本模板开始了我的项目。我使用SQL Server 2008 R2和现有的数据库来处理登录和注册(而不是使用SQL Server Express的EF)。
我已经进行了使用现有数据库所需的更改。 唯一的问题是,在我登录到Web应用程序并保持非活动状态几分钟并刷新管理页面后,我收到了SQL Server错误
SQLExpress数据库文件自动创建错误
请注意,注销后登录显示的管理页面没有例外。
即使我从另一个浏览器登录而另一个浏览器显示异常,ctrl + F5也不见了,就像登录重新创建连接一样。
SQLEXPRESS
?请记住,SQL Server服务正在运行,因此不是问题。
有什么想法吗?
堆栈跟踪:
[SqlException(0x80131904):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:26 - 查找指定的服务器/实例时出错)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection,Action
1 wrapCloseInAction) +6573870
1 retry,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal& connection)+953 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +6600312 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +219 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +6602662 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +6603203 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +942 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +816 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions) +61 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +6610951 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
1 retry)+233 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)+278 System.Data.SqlClient.SqlConnection.Open()+239 System.Web.Management.SqlServices.GetSqlConnection(String server,String user,String password,Boolean trusted,String connectionString)+98
>
[HttpException(0x80004005):无法连接到SQL Server数据库。]
System.Web.Management.SqlServices.GetSqlConnection(String server,String user,String password,Boolean trusted,String connectionString)+4570794 System.Web.Management.SqlServices.SetupApplicationServices(String server,String user,String password,Boolean trusted,String connectionString,String database,String dbFileName,SqlFeatures features,Boolean install)+229 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName,String dataDir,String connectionString)+908