I have a .NET web app that connects to SQL Azure with no problem from my local machine. Then, on the same machine, I've created another command-line .NET app in the same solution, copied the connection string from web.config
to app.config
, referenced the same assemblies with the web server (my connection/Entity Framework/model layer is on an assembly of its own) and tried to access my database. I'm getting the following error:
Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll
Additional information: A connection was successfully established with the server,
but then an error occurred during the pre-login handshake. (provider: SSL Provider,
error: 0 - The wait operation timed out.)
Now, before you point out to many other questions out there, let me tell you in advance:
- A .NET app with the same .NET version, on the same computer/solution is able to access the same database using the very same connection string and using the same assemblies/package versions etc. with no issue.
- I've cleaned/rebuilt my solution, restarted Visual Studio and restarted my PC multiple times.
- I've executed
netsh Winsock reset
successfully, and restarted my PC afterwards. - There are no antivirus/antimalware or firewall on my PC. There has never been anything in that sense other than the Windows Firewall and built in Windows 10 components. (yep, sure, no Panda Antivirus in particular. nope, no bloatware too, it's a original Windows 10 installation, not an OEM one)
- I've tried with Windows Firewall both on and off, doesn't seem to affect.
- The machine is running as a virtual machine on Parallels, if it makes any sense. There are no multiple network adapters available to Windows, so both my web app and console app are using the same "Internet connection" in that sense.
- The connection timeout is 30 seconds, though I get the error immediately, not after 30 seconds. (it says that it has connected successfully anyways)
- Both projects run on the same Windows 10 machine, debugged through Visual Studio 2015 Update 3, are built against .NET Framework 4.6.
- I haven't even touched the problematic project in the last few weeks and it used to work perfectly a few weeks ago.
- As anything that might be suspicious: I've got Fiddler installed, but I've always had it installed at the times it used to work too. In the few weeks, AFAIR, I've just installed Steam and Visual Studio 2017 RC but they aren't open.
- I'm not getting any suspicious errors etc. at Azure side.
- I can access the server with the same credentials using SQL Server Management Studio, and query the database with no issues. (I'm having the same problem both with SSMS open, closed, and/or after restarting with/without opening it).
- I've seen countless number of questions regarding the same problem, however they almost all point to antivirus/firewall and resettting winsock and I've already done it.
Here is my connection string exactly from the config file (sensitive info replaced with XXXX):
<connectionStrings>
<add name="Data" connectionString="Server=tcp:XXXX.database.windows.net,1433;Database=XXXX;User [email protected];Password=XXXX;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
</connectionStrings>
Remember, the very same connection string is also used in the other project and it works with no issues.
I'm out of ideas. What might be wrong?
ServicePointManager
in your 'working' app - maybe there are some hacks re certifcate / tls version etc – Eliseelisee