Home All Groups Group Topic Archive Search About

ASP.NET 2.0 connecting to SQL Server 2000

Author
9 Sep 2006 4:38 PM
Todd Brewer
Windows Server 2000
ASP.NET 2.0
SQL Server 2000 (on a physically seperate server)

I moved an ASP.NET 2.0 application from a development server to production,
and am getting the following error:

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)

This app works fine on a development machine and a development server
hitting an SQL 2000 Server.

I went back to the development server and changed the web.config connection
string to point to the production SQL 2000 Server, and it works fine, so I am
pretty sure the issue is on the production web server.  I am using a very
simple connection string:

Data Source=servername;Initial Catalog=catalog;User Id=xxxxx;Password=xxxxx;

I have tried replacing the DataSource as an IP address, with no luck.  I
have tried putting 'np:' on the front to force named pipes, with no luck. 

This seems to be a very popular issue when I do searches for this error
message.  Any help would be GREATLY apprecaited!

Todd

Author
9 Sep 2006 8:56 PM
Ken Cox [Microsoft MVP]
Hi Todd,

You've probably checked but just in case...

Are you sure that the web.config that contains your data connection string
is the one that is actually executing? Be sure that the web is set as an
application in IIS, otherwise a web.config higher up might be the one that's
being used.

Ken
Microsoft MVP [ASP.NET]

Show quoteHide quote
"Todd Brewer" <ToddBre***@discussions.microsoft.com> wrote in message
news:6F01F482-EB53-4C2F-8867-516027892642@microsoft.com...
> Windows Server 2000
> ASP.NET 2.0
> SQL Server 2000 (on a physically seperate server)
>
> I moved an ASP.NET 2.0 application from a development server to
> production,
> and am getting the following error:
>
> 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)
>
> This app works fine on a development machine and a development server
> hitting an SQL 2000 Server.
>
> I went back to the development server and changed the web.config
> connection
> string to point to the production SQL 2000 Server, and it works fine, so I
> am
> pretty sure the issue is on the production web server.  I am using a very
> simple connection string:
>
> Data Source=servername;Initial Catalog=catalog;User
> Id=xxxxx;Password=xxxxx;
>
> I have tried replacing the DataSource as an IP address, with no luck.  I
> have tried putting 'np:' on the front to force named pipes, with no luck.
>
> This seems to be a very popular issue when I do searches for this error
> message.  Any help would be GREATLY apprecaited!
>
> Todd
Are all your drivers up to date? click for free checkup

Author
9 Sep 2006 9:00 PM
Rob MacFadyen
Todd,

Are you sure there is network connectivity between your production web
server and your test sql server? More than likely there is a firewall
blocking the connection. On the production server trying pinging the test
sql server. From the production server try "telnet testsqlservername 1433"..
does the screen clear or do you get an error message?

Regards,

Rob


Show quoteHide quote
"Todd Brewer" <ToddBre***@discussions.microsoft.com> wrote in message
news:6F01F482-EB53-4C2F-8867-516027892642@microsoft.com...
> Windows Server 2000
> ASP.NET 2.0
> SQL Server 2000 (on a physically seperate server)
>
> I moved an ASP.NET 2.0 application from a development server to
> production,
> and am getting the following error:
>
> 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)
>
> This app works fine on a development machine and a development server
> hitting an SQL 2000 Server.
>
> I went back to the development server and changed the web.config
> connection
> string to point to the production SQL 2000 Server, and it works fine, so I
> am
> pretty sure the issue is on the production web server.  I am using a very
> simple connection string:
>
> Data Source=servername;Initial Catalog=catalog;User
> Id=xxxxx;Password=xxxxx;
>
> I have tried replacing the DataSource as an IP address, with no luck.  I
> have tried putting 'np:' on the front to force named pipes, with no luck.
>
> This seems to be a very popular issue when I do searches for this error
> message.  Any help would be GREATLY apprecaited!
>
> Todd

Bookmark and Share