Error 19 - Physical Connection Error

There was a transport layer error while receiving results from the server. (provider: session provider, error: 19 - physical connection is not used) - occurs intermittently using a hybrid connector to connect to the local database from the Azure API

I am trying to connect to an SQL database on a local server from an application service resource (Web API). Configured endpoint of a classic hybrid connection on internal db.

+4
source share
2 answers

The root cause:

The SQL database has the Auto Close property on the Parameters tab, the default is TRUE.

Azure Service (API) SQL-. Azure .

"Auto Close as TRUE", SQL . Azure , SQL. " - 19".

:

SQL db . "" " " "" .

, Azure , , .

.

. ( ).

RETRY LOGIC Entity Framework 1.1.0

services.AddDbContext<DbContext>(options => options.UseSqlServer('yourconnectionstring',
                 sqlServerOptionsAction: sqlOptions =>
                 {
                     sqlOptions.EnableRetryOnFailure(
                         maxRetryCount: 5,
                         maxRetryDelay: TimeSpan.FromSeconds(30),
                         errorNumbersToAdd: new List<int>() { 19 });
                 }));

19 . 19, 19.

+4

, -API, . " " , Microsoft.

" : +
• . . , • . . , . (Microsoft SQL Server, : 40613) • . • System.Data.Entity.Core.EntityCommandExecutionException: . . . --- > System.Data.SqlClient.SqlException: . (: , : 19 - ) • , .

0

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


All Articles