2016-12-08 7 views
0

WebForms 응용 프로그램이 데이터베이스를 만들기 위해 엔티티 프레임 워크에 액세스하는 이유는 무엇입니까? 내 코드와 web.config에서 EF에 대한 모든 참조를 제거했습니다. InProc 세션 상태를 사용하려고합니다. 그러나 내 세션이 만료되거나 응용 프로그램 풀이 브라우저에서 호출을 재활용하면 긴 스핀이 발생하고 궁극적으로 EF에서 데이터베이스를 만들려고하는 예외가 발생합니다.ASP.NET WebForms 응용 프로그램에서 데이터베이스를 만들려고합니다

 

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 

Source Error: 


An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 



[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] 
    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling) +830 
    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +329 
    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38 
    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +682 
    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78 
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191 
    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +154 
    System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +21 
    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +90 
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +217 
    System.Data.SqlClient.SqlConnection.Open() +96 
    System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.b__36(DbConnection t, DbConnectionInterceptionContext c) +10 
    System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +72 
    System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +360 
    System.Data.Entity.SqlServer.c__DisplayClass33.b__32() +426 
    System.Data.Entity.SqlServer.c__DisplayClass1.b__0() +10 
    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +189 
    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation) +78 
    System.Data.Entity.SqlServer.SqlProviderServices.UsingConnection(DbConnection sqlConnection, Action`1 act) +175 
    System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action`1 act) +556 
    System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable`1 commandTimeout, DbConnection sqlConnection, String createDatabaseScript) +86 
    System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +164 
    System.Data.Entity.Core.Common.DbProviderServices.CreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +76 
    System.Data.Entity.Core.Objects.ObjectContext.CreateDatabase() +134 
    System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +119 
    System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +142 
    System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +78 
    System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func`3 createMigrator, ObjectContext objectContext) +89 
    System.Data.Entity.Internal.InternalContext.CreateDatabase(ObjectContext objectContext, DatabaseExistenceState existenceState) +116 
    System.Data.Entity.Database.Create(DatabaseExistenceState existenceState) +218 
    System.Data.Entity.CreateDatabaseIfNotExists`1.InitializeDatabase(TContext context) +151 
    System.Data.Entity.Internal.c__DisplayClassf`1.b__e() +76 
    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +60 
    System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +357 
    System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c) +7 
    System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +110 
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +198 
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase() +73 
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +28 
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53 
    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15 
    System.Data.Entity.Internal.Linq.InternalSet`1.FindAsync(CancellationToken cancellationToken, Object[] keyValues) +53 
    System.Data.Entity.DbSet`1.FindAsync(CancellationToken cancellationToken, Object[] keyValues) +34 
    System.Data.Entity.DbSet`1.FindAsync(Object[] keyValues) +26 
    Microsoft.AspNet.Identity.EntityFramework.EntityStore`1.GetByIdAsync(Object id) +49 
    Microsoft.AspNet.Identity.EntityFramework.d__6c.MoveNext() +163 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.AspNet.Identity.CultureAwaiter`1.GetResult() +59 
    Microsoft.AspNet.Identity.Owin.b__1>d__4.MoveNext() +909 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) +11532712 
    Microsoft.Owin.Security.Cookies.d__2.MoveNext() +2151 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +581 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.Owin.Security.Infrastructure.d__0.MoveNext() +225 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +409 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +409 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.AspNet.Identity.Owin.d__0.MoveNext() +409 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__5.MoveNext() +187 
    System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 
    System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.d__2.MoveNext() +185 
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69 
    Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64 
    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +380 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155 




Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1055.0 
+1

엔터티 프레임 워크에 대한 참조가있는 다른 프로젝트를 참조하는 경우가 있습니까? asp.net ID의 최신 버전은 엔티티 프레임 워크를 사용합니다. packages.config의 복사본을 게시 할 수 있습니까? –

+0

asp.net ID를 참조하고 있습니다. 그것이 무엇을하려고 하는가? – dviljoen

+0

사용자, 역할 및 사용되는 다른 모든 aspnet_ 테이블을 저장하는 데이터베이스를 만듭니다. 엔티티 프레임 워크를 사용하는 것은 최신 버전 일 뿐이며 버전 번호를 파헤쳐 볼 수 있는지 알게 될 것입니다. –

답변

1

당신이 엔티티 프레임 워크에 대한 참조가 다른 프로젝트를 참조하고 모든 기회를 (아래 참조)? asp.net ID의 최신 버전은 엔티티 프레임 워크를 사용합니다.

+0

도와 주셔서 감사합니다! – dviljoen