Error connecting to sql server

Discussion in 'Databases' started by mparackal, Feb 17, 2010.

  1. I get the following error when trying to access the database

    "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"

    The page work fine on my machine but when published on Winhost the above error appears. Please help

    Mathew
     
    Last edited by a moderator: Oct 14, 2015
  2. Ray

    Ray

    This error means that your application is looking for a SQL Express database to connect to. Check your application and the applications configuration file. Make sure all connection strings are trying to connect to our SQL 2008 server and drop all and any references to a SQL Express databsae. Because of security and performance concerns, we do not support SQL Express.
     
  3. You are referring to the Web.conf file - right?
    Can you point to the connection string? Also, how do I refer to your SQL 2008 server?

    Your help is much appreciated

    Mathew
     
  4. Ray

    Ray

    Yes. I am referring to the applications web.config file. It is difficult to pin point where exactly it is in your code. Try going to the web.config file and look for the element tag <connectionStrings> it is typically under that.
     
  5. Located that - thank you : )

    but there is only the closing tag for this element (<connectionStrings/>). Can you tell me what is the code that goes in this element?
     
  6. Ray

    Ray

    Try this example

    <connectionStrings>
    <remove name="LocalSqlServer" />
    <add name="LocalSqlServer" connectionString="Data Source=DBServerName;Integrated Security=false;Initial Catalog=DBName;User ID=DBLogin;Password=DBPassword" providerName="System.Data.SqlClient" />
    </connectionStrings>
     

Share This Page