管道错误40建立与SQL Server的连接时发生与网络相关或特定于实例的错误
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了管道错误40建立与SQL Server的连接时发生与网络相关或特定于实例的错误相关的知识,希望对你有一定的参考价值。
这个错误是奇怪的,因为我可以连接到我的服务器,但是在我的应用程序的正常使用期间,我偶尔会得到这个错误15分钟。最终,事情将恢复正常。不久之后,错误再次出现。我读过许多帖子,声称问题在于连接字符串和用户名/密码。但是,由于我有时可以连接它,它不能是我的用户名和密码。我的应用程序是否可能不关闭流并因此造成瓶颈?我真的不知道。
{
ExceptionMessage = "The underlying provider failed on Open.";
ExceptionType = "System.Data.Entity.Core.EntityException";
InnerException = {
ExceptionMessage = "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)";
ExceptionType = "System.Data.SqlClient.SqlException";
InnerException = {
ExceptionMessage = "Access is denied";
ExceptionType = "System.ComponentModel.Win32Exception";
Message = "An error has occurred.";
StackTrace = "<null>";
};
Message = "An error has occurred.";
StackTrace = " at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
\n at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
\n at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover)
\n at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover)
\n at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout)
\n at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance)
\n at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData)
\n at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
\n at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
\n at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
\n at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
\n at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
\n at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
\n at System.Data.SqlClient.SqlConnection.Open()
\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.<Open>b__36(DbConnection t, DbConnectionInterceptionContext c)
\n at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext](TTarget target, Action`2 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
\n at System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)
\n at System.Data.Entity.Core.EntityClient.EntityConnection.<Open>b__2()
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.<Execute>b__0()
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
\n at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Action operation)
\n at System.Data.Entity.Core.EntityClient.EntityConnection.Open()";
};
Message = "An error has occurred.";
StackTrace = " at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()
\n--- End of stack trace from previous location where exception was thrown ---
\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()";
}
问题是我没有关闭我的套接字连接。
以上是关于管道错误40建立与SQL Server的连接时发生与网络相关或特定于实例的错误的主要内容,如果未能解决你的问题,请参考以下文章
sql server 2008启动时:已成功与服务器建立连接,但是在登录过程中发生错误。(provider:命名管道提供程序,error:0-管道的另一端上无任何进程。)(Microsoft SQL
SQL Server(解决问题)已成功与服务器建立连接,但是在登录过程中发生错误。(provider: Shared Memory Provider, error:0 - 管道的另一端上无任何进程。(
如何修复错误“命名管道提供程序,错误 40 - 无法打开与“SQL Server”的连接?
在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。 错误号: 2 严重性: 20 状态: 0
为啥在建立与 SQL Server 的连接时会发生与网络相关或特定于实例的错误?
PHP sqlsrv_connect 到 SQL Server:建立与 SQL Server 的连接时发生与网络相关或特定于实例的错误