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: 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中发现了一些解决方案,但没有任何工作。这是我的连接字符串:
<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部分:
<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>
请问有谁能帮忙弄清楚出了什么问题?
解决方法
在机器B上:
1.打开名为“SQL Server Browser”的Windows服务并启动服务
2.)在Windows防火墙中,启用传入端口UDP 1434(如果机器A上的SQL Server Management Studio正在连接或机器A上的程序正在连接)
3.)在Windows防火墙中,启用传入端口TCP 1433(如果有telnet连接)
4.)在SQL Server配置管理器中,为端口1433启用TCP / IP协议
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。