参见英文答案 >
Connection to SQL Server Works Sometimes10个
我们有一个生产网站,混合了经典的ASP,inline .Net和编译的.Net,它与一个sql Server实例进行通信,两者都是同一物理盒上的虚拟机,其中的一切都很好用.为了使用新功能进行一些测试,我创建了一个QA版本的站点,并将其设置为连接到另一个物理服务器上托管的VM上的数据库.它们是不同的网络(DMZ /内部),但是所有在千兆位的同一机架中,所以连接速度不应该是一个问题.
我们有一个生产网站,混合了经典的ASP,inline .Net和编译的.Net,它与一个sql Server实例进行通信,两者都是同一物理盒上的虚拟机,其中的一切都很好用.为了使用新功能进行一些测试,我创建了一个QA版本的站点,并将其设置为连接到另一个物理服务器上托管的VM上的数据库.它们是不同的网络(DMZ /内部),但是所有在千兆位的同一机架中,所以连接速度不应该是一个问题.
我们遇到的问题是QA版本会有一些工作,然后突然死亡,直到我重新启动应用程序池和网站.这不是一个负载问题,因为只是我和另外两个人测试这个过程,我已经确认了QA数据库所在的服务器没有资源问题(16GB RAM,使用3.2GB,处理器利用率在2%范围).具体错误(如下所示)发生在所有页面的变体 – 经典ASP,inline .Net和编译的.Net页面.基于我所做的所有研究,我不断指出它是一个防火墙问题,但是我们甚至打开了两台服务器之间的所有端口,它仍然发生.最奇怪的部分是当我们在ASA(5515-X)上启用跟踪时,几乎没有任何流量,有时网站会在其他时间立即踢回该错误,而其他时间需要30秒.有关页面没有进行任何强烈的查找(一页死亡共抓取了大约60条记录).这是完整的错误/堆栈跟踪:
[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=21008; handshake=12; ] System.Data.sqlClient.sqlInternalConnection.OnError(sqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction) +6749670 System.Data.sqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose) +815 System.Data.sqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj,UInt32 error) +817 System.Data.sqlClient.TdsParserStateObject.ReadSniSyncOverAsync() +344 System.Data.sqlClient.TdsParserStateObject.TryReadNetworkPacket() +48 System.Data.sqlClient.TdsParser.ConsumePreLoginHandshake(Boolean encrypt,Boolean trustServerCert,Boolean integratedSecurity,Boolean& marsCapable) +126 System.Data.sqlClient.TdsParser.Connect(ServerInfo serverInfo,sqlInternalConnectionTds connHandler,Boolean ignoreSniOpenTimeout,Int64 timerExpire,Boolean encrypt,Boolean withFailover) +693 System.Data.sqlClient.sqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword,TimeoutTimer timeout,Boolean withFailover) +219 System.Data.sqlClient.sqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,Boolean redirectedUserInstance,sqlConnectionString connectionOptions,sqlCredential credential,TimeoutTimer timeout) +6777754 System.Data.sqlClient.sqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout,Boolean redirectedUserInstance) +6778255 System.Data.sqlClient.sqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity,Object providerInfo,sqlConnectionString userConnectionOptions,SessionData reconnectSessionData) +878 System.Data.sqlClient.sqlConnectionFactory.CreateConnection(DbConnectionOptions options,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,DbConnectionPool pool,DbConnection owningConnection,DbConnectionOptions userOptions) +1162 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool,DbConnection owningObject,DbConnectionOptions options,DbConnectionOptions userOptions) +72 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject,DbConnectionOptions userOptions,DbConnectionInternal oldConnection) +6781425 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject,DbConnectionInternal oldConnection) +103 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean allowCreate,Boolean onlyOneCheckConnection,DbConnectionInternal& connection) +2105 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource`1 retry,DbConnectionInternal& connection) +116 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,DbConnectionInternal oldConnection,DbConnectionInternal& connection) +1089 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection,DbConnectionFactory connectionFactory,DbConnectionOptions userOptions) +6785863 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.UI.Control.LoadRecursive() +71 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) +3178
我会显示一个代码块,但是由于所有的页面都开始死亡,一旦这样做不会做太多的事情.这一切在生产中都很好,所以唯一的区别是VM在不同的物理主机上,但鉴于这是所有新的硬件,没有理由这应该有问题.
我在这里也遇到过多个使用exec sp_updatestats和dbcc freeproccache的东西,但是这两个都不会有所改变.
我完全失去了任何建议?