A transport-level error has occurred when receiving results from the SQL server

Lee Taylor 31 Reputation points
2024-02-29T20:10:29.8566667+00:00

I am trying to execute a simple query against a SQL server database in my C# application. I have tried using the System.Data.SqlClient driver and the latest Microsoft.Data.SqlClient and get the same error. Query: Select * From person there are only 620 records. When the same query is used in SSMS I get results with no problems, but as soon as the query is executed in my application I get the Error "A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)". If I limit my record count using Top(470) I will get results, if I go more than that I get the failure and I do not know why. the Server version is 15.0.4138.2 and I am using SQL server authentication.

SQL Server | Other
Developer technologies | C#
{count} vote

2 answers

Sort by: Most helpful
  1. Lee Taylor 31 Reputation points
    2024-03-01T17:12:39.8733333+00:00

    The issue was related to one of the settings on the connection string.

    I went from

    Server=<myserver>,1433;Initial Catalog=<myDatabase>;Persist Security Info=False;User ID=<MyId>;Password=<Password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=True;Packet Size=32767

    To:

    Server=tcp:<myserver>;Initial Catalog=<myDatabase>;User ID=<MyId>;Password=<Password>;Packet Size=32767;TrustServerCertificate=True;

    And Problem Solved, somehow.

    0 comments No comments

  2. Hall, Patrick 0 Reputation points
    2025-04-02T14:47:55.81+00:00

    This is the part that solved it for me:

    Encrypt=True;TrustServerCertificate=True

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.