Cannot connect to database

C

cashdeskmac

Hi,

Here’s my scenario. I have two machines:

DevBox
Windows 2000
IIS version 5

Desktop
WindowsXP Pro
IIS version 5.1

I open Visual Web Developer 2008 express on desktop and Select File>open
Website, and browse to a folder on DevBox. Once opened I run the project
using F5 and it does as it should (I click a button and it connects to a
database and displays information on a page).

The trouble starts when I open IE6 on desktop and type in
http://devbox/websitename/default.aspx. It finds the website and displays
exactly the same screen, but when I click the button it times out and throws
up an 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.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)

The website uses AJAX controls, namely an UpdatePanel and Timer, and I
populate various controls in the code behind file. I have Microsoft ASP.NET
2.0 AJAX Extensions 1.0 installed on both machines.

It seems very strange that I can open the website using VWD 2008 and see it
working, but not if I browse to the website through IE6.

Can anyone suggest a possible cause?
 
N

Norman Yuan

It is not strange at all. It is very possible that you did not set up SQL
Server (it seems that you use it, but you did not mention explicitly) and.or
your ASP.NET application correctly. Points of interest:

1. Which user account your ASP.NET app is configured to use?
2. Does that account have permission to access the SQL Server/database?

When you do debugging run (press F5) on the develpment box, it is likely the
ASP.NET app is run under your account, which is likely a local admin, hence
no problem to access SQL Server.
 
B

bruce barker

when you use the vs web serer, it runs under your account (so debugging
will work), which probably has access to the sqlserver. when you use
iis, its uses the aspnet account which is local (no network access) and
is probably not set up to access your sqlserver.

-- bruce (sqlwork.com)
 
C

cashdeskmac

I have a bit more information for you.

It is SQL Server 2000 that it is trying to connect to, yet the error message
says it has trouble accessing SQL Server 2005. I don't know if that is
significant.

Also, the SQL Server is on a third machine. When connecting to it I am
passing in the SQL username and password, which works from my desktop through
VWD 2008 but not through IE6 when I browse to it.

Finally the site uses Windows Authentication.

I can't remember any oter details as I am now home for the weekend, but
hopefully someone can give me some pointers fr Monday morning.

Many thank to those who have already replied.
 
C

cashdeskmac

Bit more information: I originally copied the website from DevBox to Desktop
(and it was able to access the database before I copied it). I then added
the AJAX controls and a class to handle the data access and tested it before
copying it back to Devbox. It was then that it no longer worked when I
browse to it through IE6.
 
C

cashdeskmac

Found the problem. All I had to do was add "Persist Security Info=True;" to
the connection string and it now works in all environments.

Thanks for all the replies, and a Merry Christmas to all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top