2016-04-28 18 views
5

私はMVCコードの最初のアプリケーション開発に比較的新しく、VPSでMVCコードの最初のアプリケーションをホストしようとしました。アプリケーションを公開した後にウェブサイトを閲覧しようとしたときに、待機操作がタイムアウトになりました。私は少しの調査を行い、SQL上でTCP/IPを有効にすることを見つけた。 構成マネージャーが助けてくれたが、私は運がなかった。以下にスタックトレースが追加されています。待機操作がタイムアウトしました

[Win32Exception (0x80004005): The wait operation timed out] 

[SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=4223; handshake=2965; ] 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +356 
    System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +117 
    System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +267 
    System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +318 
    System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +211 
    System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +393 
    System.Data.SqlClient.SqlConnection.Open() +122 
    System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch(TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed) +104 
    System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +509 
    System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable`1 migrationStatements, DbConnection connection) +335 
    System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0() +15 
    System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func`1 operation) +238 
    System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements, DbTransaction existingTransaction) +271 
    System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable`1 operations, IEnumerable`1 systemOperations, Boolean downgrading, Boolean auto) +1232 
    System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration) +524 
    System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId) +193 
    System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration) +609 
    System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +613 
    System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +116 
    System.Data.Entity.MigrateDatabaseToLatestVersion`2.InitializeDatabase(TContext context) +156 
    System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action) +72 
    System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization() +483 
    System.Data.Entity.Internal.RetryAction`1.PerformAction(TInput input) +177 
    System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action`1 action) +274 
    System.Data.Entity.Internal.InternalContext.ForceOSpaceLoadingForKnownEntityTypes() +63 
    System.Data.Entity.DbContext.System.Data.Entity.Infrastructure.IObjectContextAdapter.get_ObjectContext() +31 
    OfficeTrack.DAL.Context.MasterContext..ctor() +47 
    OfficeTrack.Web.MvcApplication.Application_Start() +206 

[HttpException (0x80004005): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=4223; handshake=2965; ] 
    System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +544 
    System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +186 
    System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172 
    System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402 
    System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +343 

[HttpException (0x80004005): Connection Timeout Expired. The timeout period elapsed while attempting to consume the pre-login handshake acknowledgement. This could be because the pre-login handshake failed or the server was unable to respond back in time. The duration spent while attempting to connect to this server was - [Pre-Login] initialization=4223; handshake=2965; ] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +712 

答えて

1

私はこれが誰かのために役に立つかもしれないと思うが、将来的に同じ過ちのための答えを探して来ました。

私の直面した問題は誰もが私のアプリケーションプールにユーザーを追加するのを忘れていたために助けてくれてありがとう!私の側から愚かな間違い!

3

私は同じ問題がありました。デフォルトのタイムアウトが30秒に設定されているため、一部のSQLアップグレードコマンドが非常に長く実行され、エラーが発生しました。私はこの問題を克服するために次の記事を見つけました: EF Code First - Timeout expired. The timeout period elapsed prior to completion

私にとって、CommandTimeoutはConfiguration.csファイルで180秒に設定されていました。

幸運

+1

私が直面した問題は、ユーザーを自分のアプリケーションプールに追加することを忘れていたためでした。私の側から愚かな間違い! – sani

+1

@sani - 私の場合、アプリケーションプールユーザーをデータベースのログインに追加することも問題だったので、あなたはこの投稿の回答としてコメントを投稿するべきです! – Jimbo

関連する問題