AWS Lambda连接到SQL Server(非RDS)超时

时间:2019-05-09 14:24:23

标签: sql-server aws-lambda

我正在使用Entityframework从AWS Lambda,VPC连接到SQL Server 2008,其他设置也可以。但是仍然无法连接。我们的Intranet通过VPN连接到AWS,SQL Server在我们的Intranet中。

  

错误:{“ message”:“连接超时已过期。超时时间   在登录后阶段已过去。连接可能已计时   等待服务器完成登录过程,然后   响应;否则可能会在尝试创建时超时   多个活动连接。尝试花费的时间   连接到该服务器是-[登录前]初始化= 66;   握手= 452; [登录]初始化= 0;认证= 2;   [登录后]完成= 14214; “,”源“:”核心.Net SqlClient数据   提供者”,“ stackTrace”:“”位于   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity   身份,SqlConnectionString connectionOptions,SqlCredential   凭证,对象providerInfo,字符串newPassword,SecureString   newSecurePassword,布尔型redirectedUserInstance,SqlConnectionString   userConnectionOptions,SessionData reconnectSessionData,布尔   applyTransientFaultHandling)\ n在   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions   选项,DbConnectionPoolKey poolKey,对象poolGroupProviderInfo,   DbConnectionPool池,DbConnection owningConnection,   DbConnectionOptions userOptions)\ n在   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool   池,DbConnection owningObject,DbConnectionOptions选项,   DbConnectionPoolKey poolKey,DbConnectionOptions userOptions)\ n在   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection   owningObject,DbConnectionOptions,userOptions,DbConnectionInternal   oldConnection)\ n在   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection   owningObject,DbConnectionOptions,userOptions,DbConnectionInternal   oldConnection)\ n在   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection   owningObject,UInt32 waitForMultipleObjectsTimeout,布尔值   allowCreate,仅布尔值OneCheckConnection,DbConnectionOptions   userOptions,DbConnectionInternal&connection)\ n   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection   owningObject,TaskCompletionSource 1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)\n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource 1重试,DbConnectionOptions   userOptions,DbConnectionInternal oldConnection,DbConnectionInternal&   连接)\ n   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection   externalConnection,DbConnectionFactory connectionFactory,   TaskCompletionSource 1 retry, DbConnectionOptions userOptions)\n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource 1重试,DbConnectionOptions userOptions)\ n在   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource 1 retry)\n at System.Data.SqlClient.SqlConnection.Open()\n at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.OpenDbConnection(Boolean errorsExpected)\n at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open(Boolean errorsExpected)\n at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable 1.Enumerator.BufferlessMoveNext(DbContext   _,布尔缓冲区)\ n在Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.Execute [TState,TResult](TState   状态,Func 3 operation, Func 3验证成功)\ n   Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable 1.Enumerator.MoveNext()\n at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.GetResult[TResult](IEnumerable 1   valueBuffers,布尔型throwOnNullResult)\ n在   Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ResultEnumerable 1.GetEnumerator()\n at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor 1.EnumeratorExceptionInterceptor.MoveNext()\ n   在System.Linq.Enumerable.TryGetFirst [TSource](IEnumerable 1 source, Boolean& found)\n at System.Linq.Enumerable.First[TSource](IEnumerable 1源)处\ n   Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler。<> c__DisplayClass15_1 1.<CompileQueryCore>b__0(QueryContext qc)\n at System.Linq.Queryable.Count[TSource](IQueryable 1源)\ n   在   AWSServerlessApiCore.Controllers.ProductsController.GetSrcB2cShopProducts(字符串   关键字)   “}

0 个答案:

没有答案