When I am trying to Load page of my clients web application, which has shared connection string, I am getting the below error
A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: Session Provider, error: 19 - Physical connection is not usable)
What's the issue?
It looks like when fetching the results from server(share connection), database connection get's closed before it returns results to your web application, this can occur due to when you pickup the shared connection string and try to execute it's not able to reach the database or connection to sql server got interrrupted, if you are using Visual Studio, restart it or your local IIS and try again. If facing this issue on live website, simply resetting your application pool for your web site should recycle the connection pool should work.
If the above solution doesn't work, try restarting your SQL server(if using it locally) or if you are not using IIS end all of the debugger processes: WebDev.WebServer40.EXE which may solve your issue.
If you are still facing issue after trying all the above steps, please read moer about it here https://blogs.msdn.microsoft.com/spike/2009/04/16/a-transport-level-error-has-occurred-when-sending-the-request-to-the-server-provider-tcp-provider-error-0-an-existing-connection-was-forcibly-closed-by-the-remote-host/
Try to restart your Visual Studio and SQL server, and check, I had similar issue once, restarting Visual Studio solved it.
Would like to mention transport-level error occurs when you are receiving data from SQL Server and the connection is disconnected.
If it happens in production, resetting your application pool for your web site should recycle the connection pool.
It can also be due to the Timeout expired error, which is usually thrown when a sql query takes too long to run.
So you can check
For better output.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly