Cannot connect to database

Discussion in 'ASP .Net' started by cashdeskmac, Dec 19, 2008.

  1. cashdeskmac

    cashdeskmac Guest

    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?
    cashdeskmac, Dec 19, 2008
    #1
    1. Advertising

  2. cashdeskmac

    Norman Yuan Guest

    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.

    "cashdeskmac" <> wrote in message
    news:D...
    > 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?
    >
    Norman Yuan, Dec 19, 2008
    #2
    1. Advertising

  3. cashdeskmac

    bruce barker Guest

    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)

    cashdeskmac wrote:
    > 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?
    >
    bruce barker, Dec 19, 2008
    #3
  4. cashdeskmac

    cashdeskmac Guest

    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.
    cashdeskmac, Dec 19, 2008
    #4
  5. cashdeskmac

    cashdeskmac Guest

    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.

    "cashdeskmac" wrote:

    > 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.
    cashdeskmac, Dec 19, 2008
    #5
  6. cashdeskmac

    cashdeskmac Guest

    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.
    cashdeskmac, Dec 22, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Otis Mukinfus
    Replies:
    3
    Views:
    902
    Juan T. Llibre
    Jul 8, 2005
  2. =?Utf-8?B?a3N0cml5aG9u?=
    Replies:
    0
    Views:
    2,241
    =?Utf-8?B?a3N0cml5aG9u?=
    Aug 6, 2005
  3. Medes

    Cannot connect to the configuration database..

    Medes, Sep 29, 2006, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    127
    Medes
    Sep 29, 2006
  4. Replies:
    2
    Views:
    270
  5. Himanshu Garg

    Cannot connect to Mysql database

    Himanshu Garg, Nov 19, 2013, in forum: Python
    Replies:
    4
    Views:
    136
    Chris Angelico
    Nov 19, 2013
Loading...

Share This Page