Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 418
  • Last Modified:

provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server

Good morning all,
I have spend a few days trying to work on this issued but it does not seems to be working. I have search every where online for a possible solution but nothing seems to do the trick.
here is the error i get:
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not 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: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Now in my effor to cure the error this is what i have done:
1. Enable the TCP/IP protocol using the Surface Area Configuration Utility
2. I also include TCP/IP using cliconfg.exe
3. SQL Server browser is started.
4. SQL Server and SQL Server Browser are not exempted by the firewall because our company does not uses windows firewall on any machine.  

as you can see i have tried almost everything available trough MSDN website. if you experts have any other solution to this i will really appreciate your help.
Thanks,
COHFL

Here is the stack trace if it helps:
[SqlException (0x80131904): An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not 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) +800131
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
   System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +737554
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +114
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +381
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +181
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +173
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +357
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +30
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +494
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +84
   System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +197
   System.Web.Security.SqlMembershipProvider.GetPasswordWithFormat(String username, Boolean updateLastLoginActivityDate, Int32& status, String& password, Int32& passwordFormat, String& passwordSalt, Int32& failedPasswordAttemptCount, Int32& failedPasswordAnswerAttemptCount, Boolean& isApproved, DateTime& lastLoginDate, DateTime& lastActivityDate) +1121
   System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved, String& salt, Int32& passwordFormat) +105
   System.Web.Security.SqlMembershipProvider.CheckPassword(String username, String password, Boolean updateLastLoginActivityDate, Boolean failIfNotApproved) +42
   System.Web.Security.SqlMembershipProvider.ValidateUser(String username, String password) +83
   System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +160
   System.Web.UI.WebControls.Login.AttemptLogin() +105
   System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +99
   System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
   System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Open in new window

0
COHFL
Asked:
COHFL
  • 8
  • 6
1 Solution
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Try this from the command prompt in your machine:

telnet serverip 1433

It should open a blank window, If it doesn't opens then there is some problem with your connectivity between two machines.
0
 
COHFLAuthor Commented:
do i have to run this command from any machine?
0
 
COHFLAuthor Commented:
ok i did it from a different computer and it opens up the command window and after a few seconds it dissapear. is that what was expected?
1.JPG
2.JPG
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
Raja Jegan RSQL Server DBA & ArchitectCommented:
One small modification
Click Windows --> Run and then type cmd
and then type telnet 10.1.5.135 1433
It should open a blank window, Otherwise there are network issues between your machines.
0
 
COHFLAuthor Commented:
by windows you mean start?
I did:
clikc on start
2. typed cmd
3. typed 10.1.5.135 1433
and this is what i get:

3.JPG
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
It opened a blank screen as required.
Hence there is no issues between the network connectivity of both machines.

Check whether Windows Authentication was enabled in that machine

http://kbase.gfi.com/showarticle.asp?id=KBID002804
0
 
COHFLAuthor Commented:
ok this settings are right. Nothing need it to be modified here.
Any other ideas?
0
 
COHFLAuthor Commented:
Is there anything else i can try?
Thanks
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
What is the Port you have configured in SQL Server Configuration Manager?
Hope TCP / IP dynamic ports are set to blank and TCP/IP port was set correctly.

If so you have use that port in your connection string, Otherwise it may fail.
Kindly confirm about the Settings in SQL Server Configuration Manager.
0
 
COHFLAuthor Commented:
the port configured is the one SQL configures by default i check it and is not been block. That part works!

here is the connection string:
      <connectionStrings>
    <add name="JuvenileConnectionString" connectionString="Data Source=ITPROD;Initial Catalog=JuvenileArrest;User ID=Juvenile;Password=arrest" providerName="System.Data.SqlClient"/>
    <add name="JuvenileArrestConnectionString1" connectionString="Data Source=ITPROD;Initial Catalog=JuvenileArrest;Integrated Security=True;MultipleActiveResultSets=False;Packet Size=4096;Application Name=&quot;Microsoft SQL Server Management Studio&quot;" providerName="System.Data.SqlClient"/>
      </connectionStrings>
0
 
COHFLAuthor Commented:
i just try this:
<!--<add name="JuvenileConnectionString" connectionString="Provider=SQLNCLI;Server=10.1.5.135,1433;Database=JuvenileArrest;Trusted_Connection=yes;"/>
still does not work
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
Not sure about Front end as I am not familiar in that one anyhow all possible connection strings for SQL Server 2005 available here:

http://www.connectionstrings.com/sql-server-2005

Can you confirm one more thing, Are you able to connect this server from another SQL Server within the network.
0
 
COHFLAuthor Commented:
yes i can connect from another SQL server
0
 
Raja Jegan RSQL Server DBA & ArchitectCommented:
<< yes i can connect from another SQL server >>

If that is the case, then there is no problem with your SQL Server.
Its a problem with your connection string or from your application call to database.

Are you trying to connect the default instance or Named Instance of SQL Server ?
If Default Instance, Server name or IP would suffice
If it is named instance, then server name\instancename or IP\instancename is required.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now