This issue is happening on both WSL and on remote linux server. When I run the app, it starts up, I have access to it. Then when I go to my app’s login page, type in my info, and click login, my app just freezes. On the remote linux server, with an nginx reverse proxy, I will get a timeout after the determined time.


If I check the nginx logs, I see
failed (111: Connection refused) while connecting to upstream, client: ..., server: rtdemo.ga, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:5000/", host: "..."
and this is fine, but the most perplexing issue here is that I get the same behavior from my app when I run it on my local linux instance. There is no nginx on my local linux instance, and no logs like this letting me know that there is a connection refused. This leads my to believe that it has nothing to do with my nginx conf. The login is sending a request to a remote MS SQL server instance. My connection string is correct, I’ve checked it multiple times. I can ping the server from my linux instances.
I’ve tried changing firewall settings to allow 1434/1433,
I’ve tried downloading MS SQL server tools for linux and connecting to my SQL instance, but that didn’t work either.
For that, I got ” Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2746. ” , which apparently translates to SQL server error 10054. I tried the various fixes google provided to no avail.
I don’t even know what the exact issue is anymore. I don’t know how to ask for help on an issue that I can’t identify. I feel my sanity fading….

UPDATE: after adding in the Microsoft.Data.SqlClient dependency, the app now breaks and provides an exception as follows: Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed)


This is great news, now I have something to go on! Although i know next to nothing about ssl and sql server… hmm
Check dependencies. If you are using Data Client for SQL make sure you are using the new version that works on Linux.
I have downloaded the Data Client for SQL, and now I’m actually getting an exception! Progress!
The Exception is this: Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed)
Using the Microsoft.Data.SqlClientpackage? https://www.nuget.org/packages/Microsoft.Data.SqlClient/
With
Rather than
https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/
This is gonna be a dumb question, but once this is downloaded and installed, is it as simple as running the app? I see your using directive you’ve pointed to. Do I need to include this on startup? Adjust something in the startup file? Or literally just download it and go?
I’m downloading WSL on on my home laptop now. I will be testing very shortly.
I am not using this, Downloading this and testing now.
Have you checked TLS compatibility on both ends?
this is something that I do not know anything about, or how to even do that. I am getting a new exception now, involving that, though.
Can you help me understand why it would be working fine on windows, but suddenly become a problem when I try to run it from a Linux instance?
Do you have SQL logins allowed on your SQLServer instance? Probably, but it doesn’t hurt to check
I actually don’t have admin access to the SQL server instance. However, I’m able to run queries on the instance when i run my app in windows. I also am able to use SQL Server Management Studio and view all the data in the tables via that tool. Does that mean that SQL logins are allowed?
Make sure your version of SQL Server supports connecting to it from linux.
C# devs
null reference exceptions

source