An error has occurred while establishing a connection to the server.

Discussion in 'Databases' started by ordikid, Mar 15, 2007.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. Hi all . . my first post.

    I've developing an asp.net application connecting to SQL 2000 Database. My application runs fine locally connecting to discountasp.net database.
    There is no issue at all... the data is returned across the web to my local application.

    However when i try and run this from my discountasp.net webspace (mydomain.com) and connect using the same connection string , i get 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)



    Here isa supportdocument from microsoftswebsite :


    When you try to connect to an instance of Microsoft SQL Server 2005 from a remote computer, you may receive an error message. This problem may occur when you use any program to connect to SQL Server. For example, you receive the following error message when you use the SQLCMD utility to connect to SQL Server:
    Sqlcmd: Error: Microsoft SQL Native Client: 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.


    This problem may occur when SQL Server 2005 is not configured to accept remote connections. By default, SQL Server 2005 Express Edition and SQL Server 2005 Developer Edition do not allow remote connections. To configure SQL Server 2005 to allow remote connections, complete all the following steps:



    ?
    Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.

    ?
    Turn on the SQL Server Browser service.

    ?
    Configure the firewall to allow network traffic that is related to SQL Server and to the SQL Server Browser service.This article describes how to complete each of these steps.


    Am i right in saying this is "not me" and that this is a discountasp.net issue. Is there an option i'm missing which would configure these remote connections ?


    Many thanks!


    Stuart
     
  2. What does your connection string look like. Have you tried using the connection string in the database section of your control panel?



    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  3. Here's my connection string :

    workstation id=mssql10;packet size=4096;user id=username;data source="mssql10.discountasp.net";persist security info=False;initial catalog=database;password=password

    This is generated by visual studio.


    Using the string from the control panel gives me an error in visual studio/web application: - format of the initilisation string does not confirm.....

    The weird thing isthat my string works.. but onlylocally to the remote server.

    Thanks for your help

    Stuart
     
  4. The first thing I see is mssql10.discountasp.net is surrounded in quotes, which it should not be.

    Also, user id=username;catalog=database;password=password. You are setting these to the correct values, right?


    Joel Thoms
    DiscountASP.NET
    http://www.DiscountASP.NET
     
  5. Actually , the exact same connection sting is used and works with the visual studio version on my laptop. It's only when it gets uploaded to the domain addressthat it fails. I'll take out the quotes and see if that makes a difference. Fingers crossed!

    Stuart
     
  6. All the information is correct. I have removed the quotes and this has not made a difference. Anything else i should try ?

    Stuart
     
  7. Do you have connectionstring for 'LocalSqlServer' in your web.config?

    i mean something as follows:

    <remove name='LocalSqlServer' />
    <add name='LocalSqlServer' connectionString='Data Source=mssql10.discountasp.net;Integrated Security=False;Initial Catalog=database;User ID=username;Password=password' providerName='System.Data.SqlClient' />

    If not ,include it .

    Vikram

    DiscountASP.NET
    www.DiscountASP.NET
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page