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

查看:284
本文介绍了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)

说明:在当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。

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.

异常详细信息:System.Data.SqlClient.SqlException:在与SQL Server建立连接时出现与网络相关的或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server配置为允许远程连接。 (提供者:SQL网络接口,错误:26 - 错误定位指定的服务器/实例)

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)

源错误:

当前Web请求的执行过程中生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和位置信息。

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.

我试过很多东西,有些解决方案,我发现的计算器,但毫无效果。这里是我的ConnectionStrings:

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计算机的连接到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浏览器的Windows服务并启动服务

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

2)在Windows防火墙,启用机器A传入端口UDP 1434(如果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天全站免登陆