").Open() ...">

SQL Server Connection Timeout on VS2017

I have a console application that runs the standard:

new SqlConnection("<connection string>").Open()

but syncs with the exception below (end up):

System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not available. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP provider, error: 0 - timeout waiting for operation.) ---> System.ComponentModel.Win32Exception (0x80004005): Expected operation is waiting

When trying to open a connection to an instance of SQL Server 12 (Azure). I am having trouble determining the cause of the problem:

  • This only happens in VS2017. VS2015 executes accurate accurate code.
  • I have no problems connecting to the database via SSMS, LINQPad and the ASP.NET project in the same solution (even when using 2017).
  • Connection timeout is set to 30 seconds.
  • This only happens when working in debug mode.
  • This also happens when connecting to a local db.

.NET 4.5.2, VS15.0.0, Win10

Any ideas appreciated, I'm at a loss what could be causing this.

Edit: It seems he started working. I'm not quite sure why, but maybe upgrading to VS15.1 did the trick. Thanks everyone for the suggestions.

+4
source share
3 answers

, , ? , , , VS2015 Linqpad, . , VPN .

, , , VPN , , Avocado, COSMOS . , , . VPN-.

, , ? , , . !

+2

Azure Host, :

1) , - vs 2017

vs2017 (menu- > view- > server explorer)

node.

azure (sql server) .

, ( ? )

: / : console/web/....

2) , - .

( ( ).

( 2017 ) ( 2017).

.

, , .

3) , :

Azure SQL Database ( System.Data.SqlClient.SqlException)

Azure Exception Details: System.Data.SqlClient.SqlException: 'null'

1 2

3) ( ADO.NET)

- 1 2, , , ado.net :), : https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/data-tracing

+1

Source: https://habr.com/ru/post/1674013/


All Articles