繁体   English   中英

试图创建数据库的ASP.NET WebForms应用程序

[英]ASP.NET WebForms application trying to create a database

为什么我的WebForms应用访问实体框架来创建数据库? 我在代码和web.config中删除了所有对EF的引用。 我正在尝试使用InProc会话状态。 但是,当我的会话过期或应用程序池回收来自浏览器的所有调用时,将导致长时间旋转,最终导致EF尝试创建数据库的异常。 (见下文)

\n\n 建立与SQL Server的连接时发生与网络相关或特定于实例的错误。  服务器未找到或无法访问。  验证实例名称正确,并且已将SQL Server配置为允许远程连接。  (提供者:SQL网络接口,错误:26-指定服务器/实例时出错) \n   说明:执行当前Web请求期间发生未处理的异常。  请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。 \n\n  异常详细信息:System.Data.SqlClient.SqlException:建立与SQL Server的连接时发生与网络相关或特定于实例的错误。  服务器未找到或无法访问。  验证实例名称正确,并且已将SQL Server配置为允许远程连接。  (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)\n\n 源错误: \n\n\n  当前Web请求的执行期间生成了未处理的异常。  可以使用下面的异常堆栈跟踪来标识有关异常的来源和位置的信息。  \n\n 堆栈跟踪: \n\n\n\n [SqlException(0x80131904):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。  服务器未找到或无法访问。  验证实例名称正确,并且已将SQL Server配置为允许远程连接。  (提供者:SQL网络接口,错误:26-指定服务器/实例时出错)\n    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity身份,SqlConnectionString connectionOptions,SqlCredential凭证,对象providerInfo,字符串newPassword,SecureString newSecurePassword,布尔型redirectedUserInstance,SqlConnectionString userConnectionOptions,SessionData reconnectSessionData,DbConnectionFoolHandle,Transport +\n    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,DbConnectionPoolKey poolKey,对象poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection,DbConnectionOptions userOptions)+329\n    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池,DbConnection owningObject,DbConnectionOptions选项,DbConnectionPoolKey poolKey,DbConnectionOptions userOptions)+38\n    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection)+682\n    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection)+89\n    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean allowCreate,only Boolean OneCheckConnection,DbConnectionOptions userOptions,DbConnectionInternal&connection)+426\n    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource`1 retry,DbConnectionOptions userOptions,DbConnectionInternal&connection)+78\n    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource`1 retry,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal&connection)+191\n    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection externalConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions userOptions)+154\n    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection externalConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1重试,DbConnectionOptions userOptions)+21\n    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1重试)+90\n    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)+217\n    System.Data.SqlClient.SqlConnection.Open()+96\n    System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__36(DbConnection t,DbConnectionInterceptionContext c)+10\n    System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget目标,Action`2操作,TInterceptionContext拦截上下文,Action`3执行,Action`3执行)+72\n    System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection连接,DbInterceptionContext拦截上下文)+360\n    System.Data.Entity.SqlServer.c__DisplayClass33.b__32()+426\n    System.Data.Entity.SqlServer.c__DisplayClass1.b__0()+10\n    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1操作)+189\n    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(动作操作)+78\n    System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection,Action`1 act)+175\n    System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection,Action`1 act)+556\n    System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable`1 commandTimeout,DbConnection sqlConnection,String createDatabaseScript)+86\n    System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection连接,Nullable`1 commandTimeout,StoreItemCollection storeItemCollection)+164\n    System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection连接,Nullable`1 commandTimeout,StoreItemCollection storeItemCollection)+76\n    System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase()+134\n    System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection连接)+119\n    System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(动作mustSucceedToKeepDatabase)+142\n    System.Data.Entity.Migrations.DbMigrator.Update(字符串targetMigration)+78\n    System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext,Func`3 createMigrator,ObjectContext objectContext)+89\n    System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext,DatabaseExistenceState existState)+116\n    System.Data.Entity.Database.Create(DatabaseExistenceState existState)+218\n    System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext上下文)+151\n    System.Data.Entity.Internal.c__DisplayClassf`1.b__e()+76\n    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(动作)+60\n    System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()+357\n    System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c)+7\n    System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput输入)+110\n    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(动作1动作)+198\n    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()+73\n    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)+28\n    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()+53\n    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()+15\n    System.Data.Entity.Internal.Linq.InternalSet`1.FindAsync(CancellationToken cancellingToken,Object [] keyValues)+53\n    System.Data.Entity.DbSet`1.FindAsync(CancellationToken cancelleToken,Object [] keyValues)+34\n    System.Data.Entity.DbSet`1.FindAsync(Object [] keyValues)+26\n    Microsoft.AspNet.Identity.EntityFramework.EntityStore`1.GetByIdAsync(Object id)+49\n    Microsoft.AspNet.Identity.EntityFramework.d__6c.MoveNext()+163\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.AspNet.Identity.CultureAwaiter`1.GetResult()+59\n    Microsoft.AspNet.Identity.Owin.b__1> d__4.MoveNext()+909\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(任务任务)+11532712\n    Microsoft.Owin.Security.Cookies.d__2.MoveNext()+2151\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()+581\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext()+225\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.AspNet.Identity.Owin.d__0.MoveNext()+409\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.AspNet.Identity.Owin.d__0.MoveNext()+409\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.AspNet.Identity.Owin.d__0.MoveNext()+409\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext()+187\n    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务)+92\n    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务)+58\n    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__2.MoveNext()+185\n    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)+69\n    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)+64\n    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+380\n    System.Web.HttpApplication.ExecuteStep(IExecutionStep步骤,布尔值和已完成同步)+155\n\n\n\n\n 版本信息:Microsoft .NET Framework版本:4.0.30319;  ASP.NET版本:4.6.1055.0  \n

您是否有可能引用另一个引用了实体框架的项目? 较新版本的asp.net身份使用实体框架。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM