Provider sql network interfaces error 26 error locating server instance specified

First published on MSDN on May 13, 2007 Users often see this error message when connection to a SQL Server and don't know where to start to solve the problem. In most forums, people says this is because remote connection is not enabled on the server. This is not exactly correct. Actually, this err...


First published on MSDN on May 13, 2007

Users often see this error message when connection to a SQL Server and don’t know where to start to solve the problem. In most forums, people says this is because remote connection is not enabled on the server. This is not exactly correct. Actually, this error message give customers very specific information and the solution is quite simple.

First of all, you get this error message only if you are trying to connect to a SQL Server named instance. For default instance, you never see this. Why? Because even if we failed at this stage (i.e. error locating server/instance specified), we will continue to try connect using default values, e.g defaul TCP port 1433, default pipe name for Named Pipes. You may see other error message due to failure later, but not this error message.

Every time client makes a connection to SQL Server named instance, we will send a SSRP UDP packet to the server machine UDP port 1434. We need this step to know configuration information of the SQL instance, e.g., protocols enabled, TCP port, pipe name etc. Without these information, client does know how to connect the server and it fails with this specified error message.

In a word, the reason that we get this error message is the client stack could not receive SSRP response UDP packet from SQL Browser. It’s easy to isolate the issue. Here are the steps:

1) Make sure your server name is correct, e.g., no typo on the name.

2) Make sure your instance name is correct and there is actually such an instance on your target machine.

[Update:

Some application converts to . If you are not sure about your application, please try both ServerInstance and ServerInstance in your connection string

]


3) Make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).

4) Make sure SQL Browser service is running on the server.

5) If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.

Once you are done the steps, you should not see this error message anymore. You may still fail to connect your SQL server, but error message should be different and you have a different issue now. [

Update:

If it still fails, you may replace serverinstance with tcp:serverinstance and/or np:serverinstance and see if it succeeds with either TCP or NP protocol. That way, you can isolate the issue a little bit. ]

There is one corner case where you may still fail after you checked step 1)-4). It happens when a) your server is a named instance on cluster or on a multi-homed machine, and b) your client is a Vista machine with Firewall on. I have explained the details at:

Unable to connect to a SQL Server named instance on a cluster

[

Update May 2009

] My collegue found a good tool online which could be very helpful for users to isolate issues related to this error message. You can download PortQry from

http://support.microsoft.com/kb/832919

, run «portqry.exe -n yourservername -p UDP -e 1434». If this command returns information and it contains your target instance, then you can rule out possiblity 4) and 5) above, meaning you do have a SQL Browser running and your firewall does not block SQL Browser UDP packet. In this case, you can check other issue, e.g. wrong connection string.

As a final note, the error message for the same issue when you use SNAC is:

[SQL Native Client]SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].


If you still see this error, please post questions at MSDN


SQL Server Data Access Forum:


http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=87&SiteID=1

Please mention you already read this post and confirm steps you have taken and the results of each step.(e.g. serverinstance,etc)

Xinwei Hong, SQL Server Protocols

Disclaimer: This posting is provided «AS IS» with no warranties, and confers no rights

User-605499000 posted

Hi 

Below is the error message and also the web config.  I am using visual studio 2019 as.net c#.  I had to upgrade the sql and they changed the Jen19.mdf to Jen19.mdf1. Should I delete the old mdf and change the new one to just mdf.  Also in
the old web config they had a line listing the SQl and there was a mdf listed. I don’t have that in the new web config.  Should I? The mdf1 file has the products listed in it.  

Thanks, Jen

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.

Web config:

<?xml version=»1.0″ encoding=»utf-8″?>
<!—
For more information on how to configure your ASP.NET application, please visit
https://go.microsoft.com/fwlink/?LinkId=169433
—>
<configuration>
<configSections>
<!— For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 —>
<section name=»entityFramework» type=»System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ requirePermission=»false» />
</configSections>
<system.web>
<compilation debug=»true» targetFramework=»4.7.2″ />
<httpRuntime targetFramework=»4.7.2″ />
<pages>
<namespaces>
<add namespace=»System.Web.Optimization» />
</namespaces>
<controls>
<add assembly=»Microsoft.AspNet.Web.Optimization.WebForms» namespace=»Microsoft.AspNet.Web.Optimization.WebForms» tagPrefix=»webopt» />
</controls>
</pages>
<customErrors mode=»Off» defaultRedirect=»ErrorPage.html»>
</customErrors>
<profile defaultProvider=»DefaultProfileProvider»>
<providers>
<add name=»DefaultProfileProvider» type=»System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ connectionStringName=»DefaultConnection» applicationName=»/» />
</providers>
</profile>
<membership defaultProvider=»DefaultMembershipProvider»>
<providers>
<add name=»DefaultMembershipProvider» type=»System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ connectionStringName=»DefaultConnection» enablePasswordRetrieval=»false»
enablePasswordReset=»true» requiresQuestionAndAnswer=»false» requiresUniqueEmail=»false» maxInvalidPasswordAttempts=»5″ minRequiredPasswordLength=»6″ minRequiredNonalphanumericCharacters=»0″ passwordAttemptWindow=»10″ applicationName=»/» />
</providers>
</membership>
<roleManager defaultProvider=»DefaultRoleProvider»>
<providers>
<add name=»DefaultRoleProvider» type=»System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ connectionStringName=»DefaultConnection» applicationName=»/» />
</providers>
</roleManager>
<!—
If you are deploying to a cloud environment that has multiple web server instances,
you should change session state mode from «InProc» to «Custom». In addition,
change the connection string named «DefaultConnection» to connect to an instance
of SQL Server (including SQL Azure and SQL Compact) instead of to SQL Server Express.
—>
<sessionState mode=»InProc» customProvider=»DefaultSessionProvider»>
<providers>
<add name=»DefaultSessionProvider» type=»System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ connectionStringName=»DefaultConnection» />
</providers>
</sessionState>
</system.web>
<runtime>
<assemblyBinding xmlns=»urn:schemas-microsoft-com:asm.v1″>
<dependentAssembly>
<assemblyIdentity name=»Antlr3.Runtime» publicKeyToken=»eb42632606e9261f» />
<bindingRedirect oldVersion=»0.0.0.0-3.5.0.2″ newVersion=»3.5.0.2″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»Newtonsoft.Json» publicKeyToken=»30ad4fe6b2a6aeed» />
<bindingRedirect oldVersion=»0.0.0.0-12.0.0.0″ newVersion=»12.0.0.0″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»WebGrease» publicKeyToken=»31bf3856ad364e35″ />
<bindingRedirect oldVersion=»0.0.0.0-1.6.5135.21930″ newVersion=»1.6.5135.21930″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»Microsoft.Owin» publicKeyToken=»31bf3856ad364e35″ culture=»neutral» />
<bindingRedirect oldVersion=»0.0.0.0-4.0.1.0″ newVersion=»4.0.1.0″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»Microsoft.Owin.Security.OAuth» publicKeyToken=»31bf3856ad364e35″ culture=»neutral» />
<bindingRedirect oldVersion=»0.0.0.0-4.0.1.0″ newVersion=»4.0.1.0″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»Microsoft.Owin.Security» publicKeyToken=»31bf3856ad364e35″ culture=»neutral» />
<bindingRedirect oldVersion=»0.0.0.0-4.0.1.0″ newVersion=»4.0.1.0″ />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name=»Microsoft.Owin.Security.Cookies» publicKeyToken=»31bf3856ad364e35″ culture=»neutral» />
<bindingRedirect oldVersion=»0.0.0.0-4.0.1.0″ newVersion=»4.0.1.0″ />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<providers>
<provider invariantName=»System.Data.SqlClient» type=»System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer» />
</providers>
<defaultConnectionFactory type=»System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework»>
<parameters>
<parameter value=»mssqllocaldb» />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name=»DefaultConnection» providerName=»System.Data.SqlClient» connectionString=»Data Source=.SQLEXPRESS;Initial Catalog=aspnet-Jen19-20190804123356;Integrated Security=SSPI» />
</connectionStrings>
<system.codedom>
<compilers>
<compiler language=»c#;cs;csharp» extension=».cs» type=»Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ warningLevel=»4″
compilerOptions=»/langversion:default /nowarn:1659;1699;1701″ />
<compiler language=»vb;vbs;visualbasic;vbscript» extension=».vb» type=»Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″
warningLevel=»4″ compilerOptions=»/langversion:default /nowarn:41008 /define:_MYTYPE=&quot;Web&quot; /optionInfer+» />
</compilers>
</system.codedom>
</configuration>

  • Remove From My Forums

 locked

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:windowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesroot2faf057937b1b4f4App_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:windowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesroot2faf057937b1b4f4App_Code.1mhfv5r1.3.cs:21
      Showbook.Button2_click(Object sender, EventArgs e) in c:inetpubvhoststandisbooks.irhttpdocsShowbook.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 )

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
    \.pipesqlquery;

    2.       The corresponding TCP port or pipe name is not specified in the connection string (such as Srv1SQL2008, 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.

    • Proposed as answer by

      Friday, March 18, 2011 6:36 AM

    • Marked as answer by
      Alex Feng (SQL)
      Friday, March 25, 2011 4:19 AM

Sometimes you may see “SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified” error message when connecting to a SQL Server and don’t know where to start. In most forums people say this is because remote connection is not enabled on the server. This is not exactly correct. Actually, this error message gives customers a very specific information and the solution is quite simple.

First of all, you get this error message only if you are trying to connect to a SQL Server named instance. For a default instance you never see this. Why? Because even if we have failed at this stage (i.e. error locating server/instance specified), we will continue to try connect using default values, e.g default TCP port 1433, default pipe name for Named Pipes. You may see others error messages due to failure later, but not this error message.
Every time client makes a connection to SQL Server named instance, we will send a SSRP UDP packet to the server machine UDP port 1434. We need this step to know configuration information of the SQL instance, e.g., protocols enabled, TCP port, pipe name etc. Without this information,  a client does know how to connect to the server and it fails with this specific error message.
In other wors, the reason that we get this error message is the client stack could not receive SSRP response UDP packet from SQL Browser. It’s easy to resolve the issue. Here are the steps:

  • Make sure your server name is correct, e.g., no typo on the name.
  • Make sure your instance name is correct and there is actually such an instance on your target machine. (Try to use a connection string like .<instance-name> to connect to an instance on your local computer. E.g:  .SQLEXPRESS)
  • When you try to connect to an SQL Server instance on another server,  make sure the server machine is reachable, e.g, DNS can be resolve correctly, you are able to ping the server (not always true).
  • Make sure SQL Browser service is running on the server.
  • If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception.

Once you are done with these steps, you should not see this error message anymore.

Проблема

При попытке добавления рабочей группы в Vault с помощью консоли Autodesk Data Management Server (ADMS) или установки с помощью удаленного сервера SQL появляется следующее сообщение об ошибке:

———————
Консоль Autodesk Data Management Server
———————
При установке подключения к SQL Server произошла ошибка, связанная с сетью или экземпляром. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и SQL Server разрешает удаленные подключения (поставщик: сетевые интерфейсы SQL, ошибка: 26 — ошибка при поиске сервера/указанного экземпляра)
———————
ОК
———————

В журнале консоли ADMS Console появляется следующая запись:

Ошибка: Соединение с базой данных разорвано. Повторный запуск операции.
Исключение: ошибка, связанная с сетью или экземпляром, произошла при установке подключения к SQL Server. Сервер не найден или недоступен. Убедитесь, что имя экземпляра указано правильно и SQL Server разрешает удаленные подключения (поставщик: сетевые интерфейсы SQL, ошибка: 26 — ошибка при поиске сервера/указанного экземпляра)
Трассировка стека: в Connectivity.Core.Database.TransactionContext.OnSqlException(SqlException e)
в Connectivity.Core.Database.TransactionContext..ctor(база данных TransactionDatabase, пользователь базы данных DatabaseUser, логическая транзакция)
в Connectivity.Core.Database.TransactionBase.SetupTransactionContext(TransactionReqs, база данных TransactionDatabase, Nullable`1 dUsus)
в Connectivity.Core.BusinessLogic.WorkgroupBL.Database.CleanupRemoteSubscription(Workgroup publisher, String publationnameation, Staseasea)
в Connectivity.Core.BusinessLogic.WorkgroupBL.Database.Subscribe(рабочая группа, целевая рабочая группа, имя базы данных строки, тип базы данных KnowledgeDatababaseaseTypeaseType, стро, строaseUsUser, St, St, Ster ag)
в Connectivity.Core.BusinessLogic.WorkgroupBL.Create(String sqlServer, String sauser, String saPassword, String agent Agator Passassworworwory Lworal Ler)
в System.Runtime.Remoting.Messaging.Message.Dispatch(Объект цель)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Причины

  • Соединения между сервером источника и сервером подписчика разорваны. 
  • Это произошло из-за проблемы DNS (Domain Name System) между двумя доверенными доменами. Корневая причина проблемы должна быть изучена администратором DNS доменов.
  • Экземпляр SQL Server не запущен.

Решение

Убедитесь, что соединения между двумя узлами установлены. Простую проверку можно выполнить, выполнив следующие действия. Если соединение установлено некорректно, как указано в одном из следующих тестов, проблема подключения должна быть решена сетевым инженером или администратором базы данных:

  • Убедитесь, что SQL Server в источнике может подключиться к SQL Server в подписчике с помощью SSMS (SQL Server Management Studio), подключившись к экземпляру AUTODESKVAULT. 
  • Убедитесь, что SQL Server в подписчике может подключаться к SQL Server в источнике с помощью SSMS (SQL Server Management Studio), подключившись к экземпляру AUTODESKVAULT.

Если проблемы вызваны проблемами с DNS (Domain Name System) между двумя сайтами, одним из возможных способов разрешения имен будет использование файлов узлов на каждом сервере. Выполните указанные ниже действия. 

  1. После установления соединения между двумя сайтами убедитесь, что и издателю, и всем подписчикам назначен статический IP-адрес.
  2. На сервере издателя откройте файл hosts в Блокноте Windows. Файл находится в папке C:WindowsSystem32driversetc.
  3. Вставьте имя хоста компьютера (краткое имя) и IP-адрес подписчика.
  4. На сервере подписчика откройте файл hosts в Блокноте Windows. Файл находится в папке C:WindowsSystem32driversetc.
  5. Вставьте имя узла компьютера издателя (краткое имя) и IP-адрес.
  6. Сохраните файл.

Убедитесь, что экземпляр SQL Server, используемый Vault, запущен, если он не запущен.

  1. Войдите на сервер, на котором размещен экземпляр SQL Server, используемый Vault.
  2. Откройте консоль служб.
  3. Проверьте состояние службы SQL Server. По умолчанию это будет SQL Server (AUTODESKVAULT), но имя будет меняться, если имя экземпляра отличается от AUTODESKVAULT.
  4. Если статус не указан как выполняющийся, щелкните службу правой кнопкой мыши и выберите «Запустить».

Программы

Vault Professional

SQL Server Error 26 and SQL Server Error 40 appear when you try to connect to SQL Server. We will troubleshoot and try to fix them in the same article as both are related to connection issue. We recommend to use the below solutions for the both errors and to try to localize the problem.

The error Messages:

(provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

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)

“ Named Pipes Provider Error: 40 – Could not open a connection to SQL Server“.

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: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server)

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 the SQL Server is configured to allow remote connections. (provided: Named Pipes Provider, error: 40- Could not open a connection to the SQL Server) (Microsoft SQL Server, Error: 2).

sql server error 26

sql server error 26

SQL Server Error 26 and SQL Server Error 40

What is SQL Server Error 26?

You will get this error message while trying to connect to a SQL Server named instance and not when you use default instance. The client stack could not receive SSRP response UDP packet from SQL Browser.

How to fix Error 26 on SQL Server?

  1. Recheck the server name for any error and fix it
  2. Check the instance name for any error
  3. Check if SQL Server browser is running
  4. Control if this instance exist on server
  5. Ping the server and check if DNS can be resolved correctly

What is SQL Server Error 40?

This error appears mostly when SQL Server does not allow remote connections, Firewall Settings or TCP/IP is not enabled. We will explain below all those in order to troubleshoot easy.

Read also other SQL Server Helping Posts:

  1. How to fix SQL Server Error 229
  2. Fix SQL Server Error 233
  3. SQL Server Error 17002

How to fix error 40 on SQL Server?

  1. Check SQL Server is running
  2. Make sure that Allow Remote Connections is enabled on sql server properties
  3. Check if TCP/IP is enabled
  4. Configure to allow SQL Server in Firewall Settings
  5. Check for working fine SQL Server Browser
  6. Make sure that you can ping the SQL Server

Below we will explain the above steps in long way for better understanding and easy fix of SQL error 26 and sql error 40.

1. Check if SQL Services are running

Hint! If you are running SQL Server by using an instance name and you are not using a specific TCP/IP port number in your connection string, you must enable the SQL Server Browser service to allow for remote connections.

How to check if SQL Server Service is running?

  • Go to SQL Server Configuration Manager > SQL Server Services
  • Find the service SQL Server (MSSQLSERVER) if default or the name of your instance
  • Check if is running – should be running state with a green indication

Using Windows Command Prompt

sc query mssqlserver

For named instance name use below by by replacing instancename with the actual SQL Server instance name.

sc query mssql$instancename

How to check if SQL Server Browser is running?

  • Navigate to SQL Server Configuration Manager > SQL Server Services
  • Find the SQL Server Browser Service
  • Check if it is configured to start automatically and is started – should be with a green indication

Using Windows Command Prompt

sc query sqlbrowser

Check if SQL Server Service

Check if SQL Server Service

2. Try to Flush DNS

How to flush DNS?

  1. Click Start Button
  2. Type CMD and press enter
  3. Type this into the black window that appears: ipconfig /flushdns and press enter.

Fluish DNS

Fluish DNS

3. Make sure that allow Remote Connection is enabled

Check if remote connections is allowed for applications/client. This option need to be allowed to establish connections and perform operations on the server. Often this is the reason of SQL Server Error 26 and SQL Server Error 40.

How to check if the remote connection is enabled?

  1. Open ‘SQL Server Management Studio’
  2. Right click on database name and select ‘Properties’
  3. In ‘Properties’ window, select ‘Security’, enable `SQL Server and Windows Authentication mode` and click `OK`.
  4. Now restart the SQL server.

Allow Remote Connections

Allow Remote Connections

4. Check Firewall

Check the firewall status for any troubles:

  1. Open ‘Control Panel’ and after that ‘Windows Firewall’.
  2. Select ‘Change Settings’ In ‘Windows Firewall’,
  3. Add an exception for port ‘1434’ and name it ‘SQL Server’
  4. Enable by clicking on the checkbox

5. Connection String

This solution is on cases when you are using connection string and are you writing it wrongly. For example connection string used by .NET framework:

Server=serverAddress;Database=dbName;User Id=username;

Password=password;

  1. Check for each parameter passed in the connection string for any typographical errors.
  2. Control the validity of the username/password.
  3. Confirm if the given database exists.

6. TCPIP Protocol

This solutions can work when you have mix of default and named instance or named instances only.

How to Enable TCP/IP port?

  1. Open SQL Server Configuration Manager
  2. Click on SQL Server Network Configuration and click on Protocols for Name
  3. Right-click on TCP/IP
  4. Click Enable
  5. Restart your SQL Server instance

Enable TCP-Ip port

Enable TCP-Ip port

If you want to use a static port for your instance (instead of dynamic that changes after every restart) you can change it here.

  1. Open Properties for TCP/IP protocol
  2. Go to IP Addresses tab
  3. Scroll down to IPAll section
  4. Remove 0 value from TCP Dynamic Ports
  5. Specify your port in TCP Port

You can use this port to connect to your instance by providing <servername>,<port> or <IP>,<port> as Server Name (yes, there is a comma, not a colon).

TCP-Ip static port

TCP-Ip static port

Conclusion:

We have explained some solutions to fix SQL Server Error 26 and SQL Server Error 40 and hope that you find the fix on those solutions. The both errors are included on the same article because they have almost the same troubleshoot. If you have any other solution worked for you comment below and we will try to include it on our article.

Methods to Resolve SQL Server Error 26

Users often see “SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified” error message while connecting to SQL Server.

SQL Server Error 26

SQL Server Error 26 occurs when users trying to connect to a SQL Server named instance. The reason of the SQL Server Error 26 is the client stack could not receive SSRP response UPD packet from SQL Browser.

Tip: Fix SQL Server Management Studio Error 40

You have to create an incoming rule that allows traffic from all promising IP addresses that are configured for the failover cluster instance and from all possible IP addresses of the remote server. For this you have to follow the below steps

    • Open Adminstrative Tools, from Control Panel
    • In Adminstrative Tools, click on Windows Firewall with Advanced Security
    • Under Windows Firewall with Advanced Security on Local Computer column, click on the Inbound Rule and then select New Rule from the right pane

Windows Firewall with Advanced Security

    • From New Inbound Rule Wizard window, select Custom and then click on the Next button

Select Custom

    • Under Does this rule apply to all programs or a specific program? select All programs then click on Next button

Select All Program

    • Form Protocol type list, select Any and then click on Next button

Select Protocol Type

    • Under Which remote OP addresses does this rule apply to? select These IP addresses and then click on Add button

Select These IP Addresses

    • In IP Address dialog box, under This IP address or subnet type the IP address and then click on Ok button

IP Address

    • Under What action should be taken when a connection matches the specified conditions? select Allow the connection and then click on Next button

Allow the connection

  • Click on the Next button to complete the New Outbound Rule Wizard steps

Other Possible Causes of SQL Server Error 26 with Solution

SQL Server does not allow remote connections

  • To resolve the SQL Server Error 26 open SQL Server Management Studio, Right click on the database and select properties
  • On Security page, select SQL Server and Windows Authentication mode and click on Ok button
  • Restart SQL Server

If you are still facing the SQL Server Error 26, then there could be a same name conflict between two systems. Check whether the computer name, system name is same if yes, then try to system using its IP address.

When attempting to connect to a Sql Server instance over the network, with named instances, SqlConnection throws error 26 on .NET Core with the SqlClient nuget library.

Sample Code

using System;
using System.Data.SqlClient;
namespace ConsoleApp1 {
    class Program {
        static void Main(string[] args) {
            var sqlString = "Data Source=192.168.0.3\SQLEXPRESS;Initial Catalog=Database;User ID=sa;Password=<password>";
            var conn = new SqlConnection(sqlString);
            conn.Open();
            conn.Close();
            Console.WriteLine("Hello World!");
        }
    }
}

This sample code was tested working on .NET 4.5 and 4.6.1, but breaks on .NET Core 2.0, 1.1 and 1.0, along with versions 4.4, 4.3, and 4.1 of the System.Data.SqlClient library on nuget. I’ve been able to only reproduce this on Windows.

The server is configured for remote access as I’m able to connect to the remote instance using the same sample code full .NET Framework. The expected output should just be Hello World! and the program terminating, which happens on the full framework. However the following exception gets thrown instead on .NET Core:

System.Data.SqlClient.SqlException occurred
  HResult=0x80131904
  Message=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=Core .Net SqlClient Data Provider
  StackTrace:
   at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, Boolean applyTransientFaultHandling)
   at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
   at System.Data.SqlClient.SqlConnection.Open()
   at TestSqlAccess.Program.Main(String[] args) in C:srcPlaneStatusTestSqlAccessProgram.cs:line 9

Temporary Workaround

I figured out for now was using hostname,port instead of the hostname\instance works and connects as intended, however I’d like to use a named instance instead of having to rely on ports.

This workaround does not work for Linux, at least according to my tests, as it throws other exceptions even with this workaround, mostly being able to not connect. I haven’t checked Mac since I don’t have access to one.

Понравилась статья? Поделить с друзьями:
  • Provider sql network interfaces error 25 недопустимая строка подключения
  • Provider sql network interfaces error 25 connection string is not valid
  • Provider session provider error 19
  • Psql on error stop
  • Psql exit on error