Reputation: 21
I have been working all night trying to get a SQL Server connection from either a C# Lambda function(.Core) or an AWS EC2 instance with no luck.
I shows : Unhandled Exception: System.Data.SqlClient.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: 40 - Could not open a connection to SQL Server)
Please Help..
Upvotes: 1
Views: 285
Reputation: 21
Issue Resolved. Hopefully my solution may help to others.....
The issue was related to the SqlClient version on Linux as Lambda works in linux environment. we changed the reference from "System.Data.SqlClient": "4.3.0" to "System.Data.SqlClient": "4.1.0-rc2-24027" in project.json file
Thanks.
Upvotes: 1