title: Can not connect to sql server from docker supported asp.net core project
body: <p>I have a ASP.NET Core 2.2 project for which I turned on docker support. The project runs fine as long as it does not require database connection. For e.g Login. When I enter user credentials, I get the error as below.</p>
  
  <blockquote>
    <p>An unhandled exception occurred while processing the request.
    Win32Exception: A connection attempt failed because the connected
    party did not properly respond after a period of time, or established
    connection failed because connected host has failed to respond</p>
    
    <p>Unknown location 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: TCP Provider, error: 0 - A connection attempt
    failed because the connected party did not properly respond after a
    period of time, or established connection failed because connected
    host has failed to respond.)</p>
    
    <p>System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity
    identity, SqlConnectionString connectionOptions, object providerInfo,
    bool redirectedUserInstance, SqlConnectionString
    userConnectionOptions, SessionData reconnectSessionData, bool
    applyTransientFaultHandling) InvalidOperationException: An exception
    has been raised that is likely due to a transient failure. If you are
    connecting to a SQL Azure database consider using
    SqlAzureExecutionStrategy.</p>
    
    <p>Microsoft.EntityFrameworkCore.Storage.Internal.SqlServerExecutionStrategy+d__7.MoveNext()</p>
  </blockquote>
  
  <p>Previously the error was different when TCP/IP was not enabled in my sql server configuration manager.(Do not remember error)
  I followed the steps mentioned in the link <a href="https://jack-vanlightly.com/blog/2017/9/24/how-to-connect-to-your-local-sql-server-from-inside-docker" rel="noreferrer">https://jack-vanlightly.com/blog/2017/9/24/how-to-connect-to-your-local-sql-server-from-inside-docker</a> to solve that issue.</p>
  
  <p>I have enabled TCP/IP and named pipes as well. Also I can connect using IP from SQL Management Studio.</p>
  
  <p>Current connection string:</p>
  
  <pre><code>"ConnectionStrings": {
      "DefaultConnection": "Server=xxx.xx.xx.x,1433;Database=TestDB;User ID=username;Password=pwd;Trusted_Connection=True;MultipleActiveResultSets=true"
    },
  </code></pre>
  
  <p>Please let me know if I am missing any step. I want to connect to a local sql from my docker project</p>