title: Connection to SQL server fails after evry update of IIS hosted .net core app
body: <p>We've deployed a .net core 3.1 app to IIS server. The app connects to a SQL server on another VM. After the initial deployment the app had no problems connecting to a database. However, every time we update the app database connections fail with the following exception:</p>
  <pre><code>Microsoft.Data.SqlClient.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=21010; handshake=2; 
   ---&gt; System.ComponentModel.Win32Exception (258): The wait operation timed out.
     at Microsoft.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling, String accessToken, DbConnectionPool pool, SqlAuthenticationProviderManager sqlAuthProviderManager)
     at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
     at Microsoft.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
     at Microsoft.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     at Microsoft.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
     at Microsoft.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal&amp; connection)
     at Microsoft.Data.ProviderBase.DbConnectionPool.WaitForPendingOpen()
  </code></pre>
  <p>Restarting the Web site or restarting/resetting IIS does not help.
  The weird thing is that the connection starts working again an hour or longer after each update. This is very consistent.</p>
  <p>Connecting to the database using SSMS on the same box is never affected by app updates - i.e. it always works.</p>
  <p>When we update the app we first stop the site, copy new files into the app folder, and then start the site.</p>
  <p>Deployment environment: Windows Server 2019 Standard, SQL Server 12.0.5223.6.</p>
  <p>Has anyone run into a similar issue? Any suggestions on how to troubleshoot it?</p>