SQL 网络接口,错误:26 - 错误定位指定的服务器/实例 [英] SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified

查看:41
本文介绍了SQL 网络接口,错误:26 - 错误定位指定的服务器/实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个大问题,我想了好几天来解决,但我无法解决,所以我需要你的帮助.我在 asp.net 4.0 中有一个 Web 应用程序,我在其中实现了自定义成员资格和角色提供程序.当我打开应用程序主页时,它会连接到数据库并检索一些信息.还有一个登录表单,当我登录时,它会通过数据库验证用户并将我重定向到保留页面,但出现此错误:

Well i have a big problem that i'm trying for days to solve but i could not do it, so i need your help. I have a web application in asp.net 4.0 where i implemented custom membership and role providers. When i open the app homepage in it connects to the database and retrieves some information. There is also a login form and when i login it validates the user through the database and redirects me to the reserved pages but than this error appears:

发生与网络相关或特定于实例的错误建立与 SQL Server 的连接.未找到服务器或无法访问.验证实例名称是否正确并且SQL Server 配置为允许远程连接.(提供者:SQL网络接口,错误:26 - 定位服务器/实例时出错指定)

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)

说明:

当前执行过程中发生未处理的异常网络请求.请查看堆栈跟踪以获取更多信息错误及其在代码中的来源.

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.

异常详情:

System.Data.SqlClient.SqlException: 与网络相关的或建立连接时发生特定于实例的错误SQL 服务器.服务器未找到或无法访问.核实实例名称正确并且 SQL Server 配置为允许远程连接.(提供者:SQL 网络接口,错误:26- 定位服务器/实例时出错)

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)

源错误:

在执行过程中产生了一个未处理的异常当前网络请求.有关来源和位置的信息可以使用下面的异常堆栈跟踪来识别异常.

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.

我尝试了很多东西,我在 stackoverflow 中找到了一些解决方案,但没有任何效果.这是我的连接字符串:

I tried many things, some solution i found in stackoverflow but nothing worked. Here are my connectionstrings:

<connectionStrings>
  <clear/>
  <remove name="LocalSqlServer"/>
     <add name="LocalSqlServer" connectionString="Data Source=MSSQL2008-1;Initial Catalog=agency;
        Integrated Security=False;User ID=adis_agency;Password=niarda2012;Connect Timeout=180;Encrypt=False;
        Packet Size=4096" providerName="System.Data.SqlClient" />
     <add name="AgencyConn" connectionString="Data Source=MSSQL2008-1;Initial Catalog=agency;
        Integrated Security=False;User ID=adis_agency;Password=niarda2012;Connect Timeout=180;Encrypt=False;
        Packet Size=4096" providerName="System.Data.SqlClient"/>
</connectionStrings>

以下也是成员资格和角色管理器 web.config 部分:

Below are also the membership and role manager web.config section:

<membership defaultProvider="AuthProvider">
  <providers>
    <clear/>
      <add name="AuthProvider" type="AuthenticationProvider" applicationName="~/Reserved/" connectionStringName="AgencyConn"/>
  </providers>
</membership>
<roleManager enabled="true" defaultProvider="MyRoleProvider">
  <providers>
    <clear/>
      <add name="MyRoleProvider" type="RoleAccessProvider" connectionStringName="AgencyConn"/>
  </providers>
</roleManager>

请有人帮忙找出问题所在吗?

Please can anybody help to figure out whats wrong?

推荐答案

如果您从 Windows 机器 A 连接到 Windows 机器 B(安装了 SQL Server 的服务器),并且收到此错误,您需要执行以下操作:

If you are connecting from Windows machine A to Windows machine B (server with SQL Server installed), and are getting this error, you need to do the following:

在机器 B 上:

1.) 打开名为SQL Server Browser"的 Windows 服务并启动该服务

1.) turn on the Windows service called "SQL Server Browser" and start the service

2.) 在 Windows 防火墙中,启用传入端口 UDP 1434(以防机器 A 上的 SQL Server Management Studio 正在连接或机器 A 上的程序正在连接)

2.) in the Windows firewall, enable incoming port UDP 1434 (in case SQL Server Management Studio on machine A is connecting or a program on machine A is connecting)

3.) 在 Windows 防火墙中,启用传入端口 TCP 1433(以防有 telnet 连接)

3.) in the Windows firewall, enable incoming port TCP 1433 (in case there is a telnet connection)

4.) 在 SQL Server 配置管理器中,为端口 1433 启用 TCP/IP 协议

4.) in SQL Server Configuration Manager, enable TCP/IP protocol for port 1433

这篇关于SQL 网络接口,错误:26 - 错误定位指定的服务器/实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆