Using SQL Server 2000 with ASP.NET 2.0

Discussion in 'ASP.NET 2.0' started by rbunker, Nov 20, 2005.

  1. We are porting to ASP.NET 2.0 in two steps. First port the web app to 2.0. Then port the SQL Server 2000 database to SQL Server 2005.I used the iis manager on discountasp.net to change my .NET framework to 2.0. Once I did that a connection string that worked fine under 1.1 began failing with the 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)"

    It appears that it is trying to use SQL Server 2005 to connect to a SQL Server 2000 database.
    Do SQL Server 2000 and SQL Server 2005 use different ports? In 2.0 are you somehow mapping to the 2005 port?

    Below is a series of experiments I have done that I believe demonstrates quite strongly that the problem is with discountasp.net

    <!--StartFragment -->
    If I run sqladmin.discountasp.net and enter the following I can access my Sql Server 2000 database (note SQL Server 2000)
    Sql Server Name: mssql09.discountasp.net
    Username: db_156110_1_user
    SQL Password: ...

    I wrote a small application in .NET 2.0 that runs on my local machine that accesses the mssql09.discountasp.net database and that works fine. Here a code snippet that connects to the database.

    string connString = "Trusted_Connection=false; persist security info=False; Data Source=mssql09.discountasp.net;Initial Catalog=DB_156110_1;User ID=DB_156110_1_user;Password=...";
    SqlConnection conn = new SqlConnection(connString);
    conn.Open();<X-TAB></X-TAB>// the open succeeds

    My web app (http://www.mumde.net/Login.aspx) that uses the same connection string worked fine in ASP.NET 1.1

    I converted my www.mumde.net site to use ASP.NET 2.0

    After doing that the web app (http://www.mumde.net/Login.aspx) fails with the following 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)"

    This is a puzzling error message because it mentions SQL Server 2005 but the mssql09.discountasp.net database is a Sql Server 2000 database.

    However, the same web app when run on my local machine connects successfully.

    Why would that connection string work if I use it on my local machine but not work on your server? And why is SQL Server 2005 involved?

    I tried specifying the port 1433 in my connection string but that did not work either (it did work locally though)

    I don't know what to do next. Do SQL Server 2005 and SQL Server 2000 listen on different ports? In ASP.NET 2.0 are you somehow mapping 1433 to the SQL Server 2005 port?

    Any suggestions would be greatly appreciated.

    --ralph
     
  2. My fault.


    The problem was that my program reads the connection string from web.config based on the domain name. The web page is intended to work in domain X (but was being tested on mumde.net with ASP.NET 2.0). Itwas reading the connect string for X instead of mumde.net. So no matter what I did to the mumde.net connection string it had no effect.

    thanks to tech support at discountasp.net for writing a simple page that demonstrated that my connection string worked thereby forcing me to see what the problem really was.
     
  3. It make sense,I'm having same problem so what exactly did you do to resolve the issue.


    Regards,


    ZEB
     

Share This Page