SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

  • Hi all, i'm not sure if this is the right place to put this post, so if anyone has an alternative place for it to go then please, suggest away.

    My problem here is a database (DB1) that resides on a 2005 server with 20 other databases. Around 6pm DB1 is innacessible. Yet all the other db's are able to be accessed. Now DB1 web client is held on another server, it is through the web interface that i receive this error message. I have checked that the settings on the server i.e. Named Pipes were enabled and they are. I checked the logs and the event viewer and nothing seems obvious to the cause of the error. I'd appreciate your help on this. Thanks in advance.

    Server Error in '/' Application.

    --------------------------------------------------------------------------------

    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)

    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 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)

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [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.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887

    System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194

    System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4860189

    System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90

    System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +342

    System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221

    System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189

    System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185

    System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31

    System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433

    System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66

    System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499

    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65

    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117

    System.Data.SqlClient.SqlConnection.Open() +122

    System.Web.SessionState.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo) +93

    [HttpException (0x80004005): Unable to connect to SQL Server session database.]

    System.Web.SessionState.SqlSessionStateStore.ThrowSqlConnectionException(SqlConnection conn, Exception e) +229

    System.Web.SessionState.SqlStateConnection..ctor(SqlPartitionInfo sqlPartitionInfo) +383

    System.Web.SessionState.SqlSessionStateStore.GetConnection(String id, Boolean& usePooling) +205

    System.Web.SessionState.SqlSessionStateStore.DoGet(HttpContext context, String id, Boolean getExclusive, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +134

    System.Web.SessionState.SqlSessionStateStore.GetItemExclusive(HttpContext context, String id, Boolean& locked, TimeSpan& lockAge, Object& lockId, SessionStateActions& actionFlags) +48

    System.Web.SessionState.SessionStateModule.GetSessionStateItem() +117

    System.Web.SessionState.SessionStateModule.BeginAcquireState(Object source, EventArgs e, AsyncCallback cb, Object extraData) +487

    System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66

    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

  • Please don't crosspost. It just wastes people's time and fragments replies.

    No replies to this thread please. Direct replies to http://www.sqlservercentral.com/Forums/Topic935796-1291-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Huh?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • Hi

    Check u have installed Correctly SQL server and configured properly, if u r still facing the same problem check data base server address inserted in configuration file or its on a same server Check its pc name is Correct

    Regards

    Shereena Haris

    Sr. Software Architect

    Visit My blog http://worldipvoice.blogspot.com/

  • Thank You So Much Shreena. I opened SQL server and copy the Connection and paste that in my ConnectionString It Works very well. Thank Again

  • HI Ayeesha

    I am very Happy to hear that, my post help you to solve your issue.

    Regards

    Shereena Haris

    Chief Technology Officer at Xamcenter

  • HI Ayeesha

    I am very Happy to hear that, my post help you to solve your issue.

    Regards

    Shereena Haris

    Chief Technology Officer at Xamcenter

  • Hi,

    1) Please double check your connection string

    2) Please make sure your DB server connects and user/pass is correct in the connection string.

    If the above points are fine. Then your code should work.

    Thanks

    S.Ragunath

  • hye ayeeshagopi , can u explain it very well ?

    copy the connection ? where u copy?

    if u can explain step by step , glad to know that 🙂

    thanks ,

    za 🙂

  • hi

    refer this lin

    Soultion for configuration error

  • hi

    we need enable the TCP/IP in sql server configuaration area manager

Viewing 12 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic. Login to reply