Background: I'm porting over applications to docker containers using the latest 4.8 ASP net container. They all use SQL Server connections.
App1: Framework 4.8, no issues at all. App2: Framework 4.6.2, can't establish a connection to the SQL Server at all.
Here's the connection string:
<add name="DefaultConnection" connectionString="Data Source=172.31.0.2; Initial Catalog=Integ_Catalog; User ID=MYUSER; Password=Pa55W0rd; MultipleActiveResultSets=True;Connect Timeout=120" providerName="System.Data.SqlClient" />
From within the container, I've ran Powershell to verify the connection string is 100% working. I've updated dapper to the latest version hoping that would help. Any ideas what to try?
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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open()
* Update *
When the app was within the same AWS VPC as the DB, the calls would fail. But when they are in a different VPC, it would work. This makes no sense, you'd think it would be the other way around. Networking on the DB, App/Host and within the VPC look fine.
User contributions licensed under CC BY-SA 3.0