简体   繁体   English

脚手架后的迁移问题。 (提供者:SQL 网络接口,错误:26 - 错误定位服务器/指定的实例)

[英]Migration issue after scafolding. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

In trying to follow this example .在试图效仿这个例子

After scaffolding, when I'm trying to execute the commands:搭建脚手架后,当我尝试执行命令时:

Add-Migration InitialCreate

Update-Database

I receive this error:我收到此错误:

A network-related or instance-specific error occurred while establishing a connection to SQL Server.与 SQL 服务器建立连接时发生与网络相关或特定于实例的错误。 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.验证实例名称是否正确,并且 SQL 服务器配置为允许远程连接。 (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (提供者:SQL 网络接口,错误:26 - 错误定位服务器/指定的实例)

I have already configured tcp protocols, allowed the tcp ports through firewall, but with no success.我已经配置了 tcp 协议,允许 tcp 端口通过防火墙,但没有成功。

The problem might be in your connection string.问题可能出在您的连接字符串中。

 "Server=localhost;Database=DatabaseNameHere;Trusted_Connection=True;MultipleActiveResultSets=true"

Ensure it uses either localhost or localhost\SQLEXPRESS, depending on your SQL Server installation.确保它使用 localhost 或 localhost\SQLEXPRESS,具体取决于您的 SQL 服务器安装。

The microsoft docs describe the exact steps to resolve this issue, it almost always has something to do with a typo in de name of the server instance. microsoft 文档描述了解决此问题的确切步骤,它几乎总是与服务器实例名称中的拼写错误有关。

https://blogs.msdn.microsoft.com/sql_protocols/2007/05/13/sql-network-interfaces-error-26-error-locating-serverinstance-specified/ https://blogs.msdn.microsoft.com/sql_protocols/2007/05/13/sql-network-interfaces-error-26-error-locating-serverinstance-specified/

To quote:去引用:

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.总之,我们收到此错误消息的原因是客户端堆栈无法接收来自 SQL 浏览器的 SSRP 响应 UDP 数据包。 It's easy to isolate the issue.很容易隔离问题。 Here are the steps:以下是步骤:

1) Make sure your server name is correct, eg, no typo on the name. 1) 确保您的服务器名称是正确的,例如,名称上没有错字。

2) Make sure your instance name is correct and there is actually such an instance on your target machine. 2)确保您的实例名称正确,并且您的目标机器上确实有这样的实例。 [Update: Some application converts \ to. [更新:某些应用程序将 \ 转换为。 If you are not sure about your application, please try both ServerInstance and Server\Instance in your connection string]如果您不确定您的应用程序,请在您的连接字符串中同时尝试 ServerInstance 和 Server\Instance]

3) Make sure the server machine is reachable, eg, DNS can be resolve correctly, you are able to ping the server (not always true). 3) 确保服务器机器可访问,例如,DNS 可以正确解析,您可以 ping 服务器(并非总是如此)。

4) Make sure SQL Browser service is running on the server. 4) 确保服务器上正在运行 SQL 浏览器服务。

5) If firewall is enabled on the server, you need to put sqlbrowser.exe and/or UDP port 1434 into exception. 5) 如果服务器启用了防火墙,则需要将 sqlbrowser.exe 和/或 UDP 端口 1434 放入异常。

The (provider: Named Pipes Provider, error: 40) after (provider: SQL Network Interfaces, error: 26) appears mostly when SQL Server does not allow remote connections, Firewall Settings or TCP/IP is not enabled. (provider: Named Pipes Provider, error: 40) 后面的(provider: SQL Network Interfaces, error: 26) 主要出现在 SQL 服务器不允许远程连接、防火墙设置或 TCP/IP 未启用时。

Some fast trobleshoot steps are:一些快速的故障排除步骤是:

  1. Check SQL Server is running检查 SQL 服务器是否正在运行
  2. Make sure that Allow Remote Connections is enabled on sql server properties确保在 sql 服务器属性上启用了允许远程连接
  3. Check if TCP/IP is enabled检查是否启用了 TCP/IP
  4. Configure to allow SQL Server in Firewall Settings在防火墙设置中配置为允许 SQL 服务器
  5. Check for working fine SQL Server Browser检查工作正常 SQL 服务器浏览器
  6. Make sure that you can ping the SQL Server确保您可以 ping SQL 服务器

The following source explain the above steps in long way for better understanding: https://www.get-itsolutions.com/sql-server-error-26-sql-error-40-fix/以下来源详细解释了上述步骤以便更好地理解: https://www.get-itsolutions.com/sql-server-error-26-sql-error-40-fix/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL服务器错误(提供程序:SQL网络接口,错误:26-错误指定服务器/实例的位置) - SQL SERVER ERROR (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) 连接数据库ASP .NET MVC 5 SQL网络接口时出现问题,错误:26-指定服务器/实例时出错 - Issue connecting to databases ASP .NET MVC 5 SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified 在我的VM上:SQL网络接口,错误:26-查找指定的服务器/实例时出错 - on my VM: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified SQL网络接口,错误:26-定位本地数据库上指定的服务器/实例时出错 - SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified on LocalDB SQL Server:无法从本地网站连接(SQL网络接口,错误:26-指定服务器/实例时出错) - SQL Server: cannot connect from local website (SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) .NET Core WebAPI 应用程序在本地连接,但在服务器上失败,并出现 SQL 网络接口错误:26 定位服务器/指定实例时出错 - .NET Core WebAPI app connects locally but fails on the Server with SQL Network Interfaces error: 26 Error Locating Server/Instance Specified 使用C#的SQL上的错误26,指定了错误定位服务器/实例 - Error 26 on SQL with C#, error locating server / instance specified SQL错误:26-查找指定的服务器/实例时出错 - SQL error:26 - Error Locating Server/Instance Specified SQL Server EXPRESS:错误:26-在安装后指定服务器/实例时出错 - SQL Server EXPRESS: Error: 26 - Error Locating Server/Instance Specified after setup ASP.Net错误26错误定位指定的服务器/实例 - ASP.Net Error 26 Error Locating Server/Instance Specified
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM