none
provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

    Question

  • I used profile for shopping cart 

     Collapse
    <system.web>
    <anonymousIdentification enabled="true"/>
    <customErrors mode="Off"></customErrors>
    <profile enabled="true">
    <properties>
    <add name="SCart" serializeAs="Binary" type="Tandis.Cart" allowAnonymous="true"/>
    </properties>
    </profile>
    </system.web>

    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: 

    Line 19:   public virtual Tandis.Cart SCart {
    Line 20:     get {
    Line 21:       return ((Tandis.Cart)(this.GetPropertyValue("SCart")));
    Line 22:     }
    Line 23:     set {

    Source File: c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2faf0579\37b1b4f4\App_Code.1mhfv5r1.3.cs    Line: 21 

    Stack Trace: 

    [SqlException (0x80131904): 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)]
      System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849719
      System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
      System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4863021
      System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90
      System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376
      System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221
      System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189
      System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4864151
      System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +31
      System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +433
      System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
      System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +499
      System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
      System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
      System.Data.SqlClient.SqlConnection.Open() +122
      System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate) +87
      System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation) +221
      System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc) +772
      System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties) +433
      System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider) +258
      System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName) +132
      System.Configuration.SettingsBase.get_Item(String propertyName) +102
      System.Web.Profile.ProfileBase.GetInternal(String propertyName) +36
      System.Web.Profile.ProfileBase.get_Item(String propertyName) +68
      System.Web.Profile.ProfileBase.GetPropertyValue(String propertyName) +7
      ProfileCommon.get_SCart() in c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\2faf0579\37b1b4f4\App_Code.1mhfv5r1.3.cs:21
      Showbook.Button2_click(Object sender, EventArgs e) in c:\inetpub\vhosts\tandisbooks.ir\httpdocs\Showbook.aspx.cs:22
      System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +108
      System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument) +118
      System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
      System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
      System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
      System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4206; ASP.NET Version:2.0.50727.4209

    it works locally on IIS but on the host it gives this error!
    what should I do ? (my host is plesk 9.5 )
    Wednesday, March 16, 2011 1:00 PM

Answers

  • Hi Nima,

     

    Thank you for your post.

    The reasons for throwing this issue could be wrong server name, disabled remote connection
    and firewall blocking.

    Could you please follow the steps below to solve this issue?

    ·         Check the server on which SQL Server is running can be accessible. You can use ping command to test that. For instance, ping <computer_name> or ping <IP_address>. The ping command may be block by the firewall, make sure ICMP is enabled in the firewall. More info, check: http://technet.microsoft.com/en-us/library/cc739791%28v=ws.10%29.aspx#BKMK_4.

    ·         Choose appropriate protocol

    ·         Configure Windows firewall accordingly based on what protocol you have chosen to use. For detailed information about how to configure Windows Firewall to allow SQL Server, please check http://msdn.microsoft.com/en-us/library/cc646023.aspx.

    ·         Enable SQL Server Browser Services

    You need to enable SQL Server Browser Services if the following are both true:

    1.       SQL Server is not listening on default 1433 port or not use default pipe name \\.\pipe\sql\query;

    2.       The corresponding TCP port or pipe name is not specified in the connection string (such as Srv1\SQL2008, 1500).

    If you have enabled SQL Server Browser Services, you still need to open UDP 1434 port which is used by Browser Services in the Windows firewall.

     


    Best Regards,
    Peja Tao

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Friday, March 18, 2011 6:35 AM

All replies

  • Hello,

    If it works on your machine, but not on the provider host: Is on the host SQL Server installed with the same instance name and also the same credentials (Sql accounts to logon)? Otherwise you have to modify the connection string.


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing
    Wednesday, March 16, 2011 1:26 PM
  • Hi Nima,

     

    Thank you for your post.

    The reasons for throwing this issue could be wrong server name, disabled remote connection
    and firewall blocking.

    Could you please follow the steps below to solve this issue?

    ·         Check the server on which SQL Server is running can be accessible. You can use ping command to test that. For instance, ping <computer_name> or ping <IP_address>. The ping command may be block by the firewall, make sure ICMP is enabled in the firewall. More info, check: http://technet.microsoft.com/en-us/library/cc739791%28v=ws.10%29.aspx#BKMK_4.

    ·         Choose appropriate protocol

    ·         Configure Windows firewall accordingly based on what protocol you have chosen to use. For detailed information about how to configure Windows Firewall to allow SQL Server, please check http://msdn.microsoft.com/en-us/library/cc646023.aspx.

    ·         Enable SQL Server Browser Services

    You need to enable SQL Server Browser Services if the following are both true:

    1.       SQL Server is not listening on default 1433 port or not use default pipe name \\.\pipe\sql\query;

    2.       The corresponding TCP port or pipe name is not specified in the connection string (such as Srv1\SQL2008, 1500).

    If you have enabled SQL Server Browser Services, you still need to open UDP 1434 port which is used by Browser Services in the Windows firewall.

     


    Best Regards,
    Peja Tao

    Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
    Friday, March 18, 2011 6:35 AM
  • Hi Hima,

    The problem is on your web.config. The application use the profile in your local database SQL it's  on the file machine.config C:\Windows\Microsoft.NET\Framework\v2.0.50727\config

     

    Un example:

    in your machine.config you have this:

            <membership>
                <providers>
                    <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
                </providers>
            </membership>
            <profile>
                <providers>
                    <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                </providers>
            </profile>
            <roleManager>
                <providers>
                    <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                    <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
                </providers>
            </roleManager>

     

    In your web.config you have to write this:

            <remove connectionStringName="LocalSqlServer">

    and add you connectionStringName.

     

    Best regards,

    • Proposed as answer by dacraka Friday, March 02, 2012 2:21 AM
    Thursday, March 24, 2011 9:30 PM
  • hi Everyone,

     

     I am also facing same problem.I follow the above steps but didnt get any positive result. still facing problem.

     

     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)

    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
       at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
       at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
       at System.Data.SqlClient.SqlConnection.Open()
       at System.Web.DataAccess.SqlConnectionHolder.Open(HttpContext context, Boolean revertImpersonate)
       at System.Web.DataAccess.SqlConnectionHelper.GetConnection(String connectionString, Boolean revertImpersonation)
       at System.Web.Profile.SqlProfileProvider.GetPropertyValuesFromDatabase(String userName, SettingsPropertyValueCollection svc)
       at System.Web.Profile.SqlProfileProvider.GetPropertyValues(SettingsContext sc, SettingsPropertyCollection properties)
       at System.Configuration.SettingsBase.GetPropertiesFromProvider(SettingsProvider provider)
       at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
       at System.Configuration.SettingsBase.get_Item(String propertyName)
       at System.Web.Profile.ProfileBase.GetInternal(String propertyName)
       at System.Web.Profile.ProfileBase.get_Item(String propertyName)
       at System.Web.Profile.ProfileBase.GetPropertyValue(String propertyName)
       at PowellsSearch.ProfileCommon.get_ExportOption() in D:\PIP-Test\PIP 25_April_Backup_with_Profile_implemented\PowellsSearch\ProfileCommon.cs:line 24
       at BooksHistory.InitializeOfflineByProfile() in D:\PIP-Test\PIP 25_April_Backup_with_Profile_implemented\PowellsSearch\BooksHistory.aspx.cs:line 612
       at BooksHistory.InitializeOfflineUser() in D:\PIP-Test\PIP 25_April_Backup_with_Profile_implemented\PowellsSearch\BooksHistory.aspx.cs:line 544
       at BooksHistory.Page_Load(Object sender, EventArgs e) in D:\PIP-Test\PIP 25_April_Backup_with_Profile_implemented\PowellsSearch\BooksHistory.aspx.cs:line 53

    Can any body help me?

    Tuesday, April 26, 2011 10:02 AM
  • Tuesday, June 05, 2012 7:59 AM
  • Hi I  have this exact same problem. I have tried things about but no luck. Im not a pro at this, just learned in the evening afterowrk. Could you please tell me what you mean by:

    In your web.config you have to write this:

            <remove connectionStringName="LocalSqlServer">

    and add you connectionStringName.

    I have put this in my web.config just under my connection string but it is throwing an error.

    PS: Just like the above I am using profile and the sites works great on my local server but when i put it on the remote it give me that ugly error

    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)

    I have disable my firewall, started browser, enabled the protocols, and now im teary eyed cause i thought i had this thing working! 

    :'(

    Could someone please explain what is going on? Like why it would work fine on the local server but not on the host. And maybe more details on how I can fix this. Thanks for any help!


    • Edited by travis_oso Thursday, July 26, 2012 3:41 AM
    Thursday, July 26, 2012 3:36 AM
  • Did you ever solve this? I am using the exact same ASP 2.0 Shoppoing cart and getting the same error as you, works great on local but not on host. Do you remember how you fixed this? Thank you!!
    Thursday, July 26, 2012 3:43 AM
  • Try this, under "Resolution for Windows 7 and Windows Server 2008 R2":

    http://support.microsoft.com/?kbid=2002980

    Solved my headache.

    Regards

    Friday, August 24, 2012 11:20 PM
  • I make my web.config as followed and it is worked well  :

    <?xml version="1.0"?>

    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=169433
      -->
    <configuration>
      <connectionStrings>
        <remove name="LocalSqlServer"></remove>
        <add name="LocalSqlServer" connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=aspnet_db;Data Source=."/>
      </connectionStrings>
      <system.web>
        <compilation debug="true" targetFramework="4.0" />
        <webParts enableExport="true"></webParts>
        
        <httpHandlers/>
        <membership>
          <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
          </providers>
        </membership>
        <profile>
          <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
          </providers>
        </profile>
        <roleManager>
          <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" connectionStringName="LocalSqlServer" applicationName="/" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
            <add name="AspNetWindowsTokenRoleProvider" applicationName="/" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
          </providers>
        </roleManager>
      </system.web>
    </configuration>

    Saturday, December 15, 2012 1:55 PM
  • I fixed this error by correcting the database server's hostname - IP mapping entry in the file C:\WINDOWS\system32\drivers\etc\hosts in the application host server
    Sunday, April 21, 2013 10:45 AM