Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
| Search | Today's Posts | Mark Forums Read
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 14th, 2005, 02:12 AM
Registered User
 
Join Date: Dec 2005
Location: Bangalore, Karnataka, India.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sql server 2005 connection problem

Hi to all
I installed SQL server 2005 from other computer. Now if i reterive database in my application ( Using ASP.Net 2.0,C# and SQL Server 2005). I am getting this error ..

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)

plz can anyone help me

Mahen
  #2 (permalink)  
Old January 3rd, 2006, 09:10 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am getting the same error. I have enable Pipes and TCP/IP in the configuration. I can use SQL Server 2005 CTP to connect to SQL databases, but when I try to run a cmd line osql -E I get the same message as Mahenj.

  #3 (permalink)  
Old January 5th, 2006, 10:05 PM
Registered User
 
Join Date: Dec 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

After upgrading an ASP.NET 1.1 application to ASP.NET 2.0, my Windows XP Pro computer had the following symptoms:

1. After launching Internet Explorer 6.x, and typing the address http://localhost/, this error message was produced:

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)

2. After selecting Start>Run> and typing cmd to get a command window, the SQL Server command “osql –E” produced the following error message:

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.
Named Pipes Provider: Could not open a connection to SQL Server [2].


I spent 6 hours of googling and researching in the attempt to restore the .NET functionality I enjoyed before the upgrade. Microsoft’s “Named Pipes Provider” error really threw me into a troubleshooting course I shouldn’t have had to travel down. Enabling "Pipes", under the SQL Native Client Protocol, was not the answer. Neither was deinstalling and reinstalling SQL Server 2005 Express or sacrificing a farm animal. I finally figured out the solution. The DBConn setting in IIS 5’s ASP.NET Configuration tab for the web site instance was somehow set incorrectly, by either the IIS 5 or ASP.NET 2.0 software applications, or so one could assume. I can assure you it was not directly changed by this author. If you have either symptom, as described above, take the following steps:

Right-click on My Computer
Select Services and Applications
Select Internet Information Services
Select Web Sites
Right-click on the web site name and select Properties from the contextual menu
Select on the ASP.NET tab
Click the Edit Configuration button
When the ASP.NET Configuration Settings popup window appears, ensure the General tab is selected.
In the Application settings area, ensure the DBConn value matches the DBConn string settings in your .NET application’s Web.Config file. If it doesn’t, highlight the DBConn setting and choose the Edit button to correct this.

**********Warning**********
If you take these steps to recover from the dreaded “Named Pipes Provider” sucker-punch, ensure you maintain a copy of your Web.Config file. After the above steps were taken, I found my Web.Config file had been stripped of all as well as minor tweaks in the coding to such an extent that the application refused to run until I restored the Web.Config file to its original condition.

Hope this helps,

Steve Gilley
aka Michaniker
  #4 (permalink)  
Old May 19th, 2006, 03:25 AM
Registered User
 
Join Date: May 2006
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

please send me the solution.I have the same problem

  #5 (permalink)  
Old May 27th, 2006, 05:57 AM
Registered User
 
Join Date: May 2006
Location: delhi, delhi, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to krantips
Default

Quote:
quote:Originally posted by Mahenj
 Hi to all
I installed SQL server 2005 from other computer. Now if i reterive database in my application ( Using ASP.Net 2.0,C# and SQL Server 2005). I am getting this error ..

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)

plz can anyone help me

Mahen
  #6 (permalink)  
Old May 27th, 2006, 05:58 AM
Registered User
 
Join Date: May 2006
Location: delhi, delhi, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to krantips
Default

Quote:
quote:Originally posted by krantips
 
Quote:
quote:Originally posted by Mahenj
Quote:
 Hi to all
I installed SQL server 2005 from other computer. Now if i reterive database in my application ( Using ASP.Net 2.0,C# and SQL Server 2005). I am getting this error ..

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)

plz can anyone help me

Mahen
  #7 (permalink)  
Old May 30th, 2006, 02:25 AM
Registered User
 
Join Date: May 2006
Location: delhi, delhi, India.
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to krantips
Default

i 'll tell u later:D

  #8 (permalink)  
Old July 11th, 2006, 03:10 AM
Registered User
 
Join Date: Jul 2006
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Mahenj
 Hi to all
I installed SQL server 2005 from other computer. Now if i reterive database in my application ( Using ASP.Net 2.0,C# and SQL Server 2005). I am getting this error ..

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)

plz can anyone help me

Mahen
Hi Mahen
I've got the same problem. Did you got any solution?
Thank's
Adrien

  #9 (permalink)  
Old July 15th, 2006, 07:05 AM
Registered User
 
Join Date: Jul 2006
Location: ISTANBUL, , Turkey.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to arsaral
Default

Hi,

I had the same problem I guess:

"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: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

I was trying to move Scott's DB examples from EXPRESS to PRO.

1st of all SQL Configuration must be right. TCPIP, PIPEs etc. must be enabled.

2nd I guess PRO keeps the connections open when you change solutions.
Or sthg like that. So I deleted the connections and created a new one.

3rd and most important: DO NOT FORGET to click the ADVANCED button and set the DB type to EXPRESS. Because the default is MSSQLSERVER.

Cheers.

Ali Riza SARAL


Ali R+ SARAL
  #10 (permalink)  
Old July 17th, 2006, 05:44 PM
Authorized User
 
Join Date: Apr 2006
Location: , , Canada.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had the same problem. Reinstalling fixed the problem.

Computers will never surpass the human brain; no computer will ever be able to replicate human stupidity.




Similar Threads
Thread Thread Starter Forum Replies Last Post
remote sql server 2005 problem navbingo20 ASP.NET 2.0 Basics 2 July 16th, 2008 03:08 AM
Microsoft SQL Server 2005 Connection Problem dontknowmuch Java Databases 0 March 7th, 2006 11:49 PM
SQL Server 2005 webBrowser problem misterC SQL Server 2005 0 February 3rd, 2006 11:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.