Error 26 A network related or instance specific error occured while establishing conn

Discussion in 'Databases' started by Sushil, Jun 23, 2012.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. To configure membership/ roles provider, I have created the remote database using aspnet_regsql.exe. I can make connection to the database through SQL Server Management Studio or Visual Studio. However, when I use the login on my website, the error 26 is thrown up. I am attaching a copy of the config file and screen shot of the error page.
    Please offer your expert advise to resolve the issue.
     

    Attached Files:

  2. martino

    martino DiscountASP.NET Staff

    Please read our knowledge base article regarding this error here: I get this error on my ASP.NET 2.0 page: "provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified"

    This error usually indicates that your application is trying to connect to a SQL Express database. We do not support SQL Express database on our servers.

    You might want to read our knowledge base article on: How to configure the ASP.NET Membership/Roles Provider to use SQL 2000, SQL 2005, SQL 2008 or SQL2012
     
  3. Thanks for your reply.
    I have read both the articles.
    I have subscribed for SQL 2008 R2 database which is now available at discountasp.net. Article 340
    The database was attached / created as per article 337. However, the connection string does not work for membership / roles.
    Should I change my subscription to SQL 2008 from SQL 2008 R2 to be able to use membership feature on my site?
    Thanks for your support.
    Sushil
     
  4. martino

    martino DiscountASP.NET Staff

    You should be able to use the SQL 2008 R2 database for your membership roles.

    May I ask what your connection string looks like (Without providing the exact details. Just censor the sensitive material.)

    Can you also provide us with any type of errors you're getting on your end?
     
  5. My connection sting is as under:

    <connectionStrings>
    <remove name="LocalSqlServer"/>



    <add name="LocalSqlServer" connectionString="Data Source=tcp:sql2k805.discountasp.net;Integrated Security=false;Initial Catalog=SQL2008R2_******_******db;User ID=SQL2008R2_******_******_user;Password=******;" providerName="System.Data.SqlClient"/>
    </connectionStrings>

    The error is as under:

    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    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)
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: 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)

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
     
  6. RayH

    RayH DiscountASP.NET Lackey DiscountASP.NET Staff

    The connection string looks fine. You may want to review the code in other parts of your application to see if the connection string is being referenced correctly.
     
  7. Did you work this out?

    Hi Sushil,

    Did you find an answer to this?
    I have the exact same problem.
    Can connect via SQL Server Management Studio AND Visual Studio (when debugging) but not when deployed to my server (code is on a seperate server to discountasp).

    So frustrating. Have checked and double checked connection strings.
    Have output debugging messages which all indicate that everything is ok right up to the point I try and connect.

    I've been programming 10+ years and this is the first time I've ever hit this problem.

    Your findings would be appreciated.
     
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