Forum Discussion
Intermittent error 40 (could not open connection to SQL Server) - Named Pipes Provider
Hi all - I've seen a few posts about problems similar to this, but nothing quite like what's going wrong. At apparently random intervals, all of the PBI Service dataset refreshes scheduled for a specific time, e.g. 11 PM, that connect to a particular on-premise SQL Server database will fail. I get the following error message:
Microsoft SQL: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server.
If I go to these datasets as little as 15 minutes later, I'll be able to manually refresh the data without issue, and the next time they refresh on schedule there will be no issue. Then, the next time (which might be the next day or not for a month), all the refreshes on a particular SQL Server database (not necessarily the same one) at a particular time will get the same error.
All the discussions I've seen similar to this have been for persistent errors, where the refresh cannot ever be performed. The solutions I've seen have focused on opening port 1433 (which we've done.) The on-prem gateway server and the database servers are on the same local network.
When I open the logs for the gateway server, this is what a representative instance of these errors look like:
GatewayPipelineErrorCode=DM_GWPipeline_Gateway_DataSourceAccessError
GatewayVersion=
ErrorClass=20
ErrorNumber=53
ErrorState=0 --->
[1]Microsoft.PowerBI.DataMovement.Pipeline.Diagnostics.GatewayPipelineWrapperException: Substituted: SqlException:<pi>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 accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): The network path was not found
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.<>c__DisplayClass31_0.<TryGetConnection>b__0(Task`1 _)
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.DataMovement.Pipeline.GatewayDataAccess.SqlDbConnectionProvider.<PrepareAndCreateSqlConnectionAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.DataMovement.Pipeline.GatewayDataAccess.SqlDbConnectionProvider.<<OpenConnectionAsync>b__5_0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.DataMovement.Pipeline.GatewayDataAccess.ImpersonatorHelper.<RunImpersonatedAsync>d__17`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.PowerBI.DataMovement.Pipeline.GatewayDataAccess.SqlDbConnectionProvider.<OpenConnectionAsync>d__5.MoveNext()
ClientConnectionId:00000000-0000-0000-0000-000000000000
Error Number:53,State:0,Class:20</pi>
I am a million miles out of my depth on this, and am having trouble finding anyone at my organization who knows more about this than i do. Have any of you ever seen something similar?
1 Reply
- v-zhangtiCommunity Support
Hi, Anonymous
For the issue, I cannot reproduce it here. We suggest you to open a ticket here for help if you are a pro user: https://powerbi.microsoft.com/en-us/support/
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.