`

IIS连接SQLServer2005时出现不允许远程连接的错误解决办法

阅读更多

今天,有个网站访问时报错如下:

Server Error in '/' Application.
--------------------------------------------------------------------------------

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) 
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: An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

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.  

Stack Trace: 


[SqlException (0x80131904): An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734995
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
   System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup) +820
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +628
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +170
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +359
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +28
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +424
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66
   System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +496
   System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +82
   System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
   System.Data.SqlClient.SqlConnection.Open() +111
   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +121
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +137
   System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +83
   System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1770
   System.Web.UI.WebControls.Repeater.GetData() +50
   System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +232
   System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +53
   System.Web.UI.WebControls.Repeater.DataBind() +72
   System.Web.UI.WebControls.Repeater.EnsureDataBound() +55
   System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +12
   System.Web.UI.Control.PreRenderRecursiveInternal() +77
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Control.PreRenderRecursiveInternal() +161
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 

 

从字面看,是数据库服务器不允许访问连接。针对这个问题,可以通过下列办法来解决:

 

1. 在SQLServer实例上设置启用远程连接.

 http://aspnetmembershipprovider.blogspot.com/2009/02/eanble-remote-connections-on-instance.html

 

2. 启动SQLServer server browser服务.

 http://aspnetmembershipprovider.blogspot.com/2009/02/enable-sql-server-browser-service.html

 

 

3. 修改Windows防火墙,允许SQLServer 和SQLServer server browser service穿过.

 

 

 

  • 大小: 82.1 KB
  • 大小: 119.3 KB
  • 大小: 51.9 KB
分享到:
评论

相关推荐

    IIS6.0 IIS,互联网信息服务

    最初是Windows NT版本的可选包,随后内置在Windows 2000、Windows XP Professional和Windows Server 2003一起发行,但在普遍使用的Windows XP Home版本上并没有IIS。 添加和运行准备  一、IIS的添加 请进入“控制...

    asp.net操作过程中常见错误的解决方法

    主要介绍了asp.net操作过程中常见错误的解决方法,主要有IIS无法识别ASP.NET、 SQL Server不允许进行远程连接可能会导致此失败等问题,感兴趣的小伙伴们可以参考一下

    超级有影响力霸气的Java面试题大全文档

    内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象是否超过作用域从而达到自动回收内存的目的,Java语言没有提供释放已分配内存的...

    nServer-v2.1023[FTP + MYSQL + HTTP + PHP(FCGI)]

    - 解决MySQL远程访问慢的问题 2012年03月30日 - 更新Nginx版本为1.0.14 2012年03月20日 - 优化PHP配置 - 优化Nginx配置 2012年03月13日 - 更新xxfpm,防止部分杀软误报 - 更新php监听端口,防止和一些下载软件...

    X-Scan v3.1

    -sql : 检测SQL-Server弱口令 -smb : 检测NT-Server弱口令 -iis : 检测IIS编码/解码漏洞 -cgi : 检测CGI漏洞 -nasl : 加载Nessus攻击脚本 -all : 检测以上所有项目 [其他选项] 含义如下: -i <适配器编号>: ...

    x-SCAN -V3.3-CN.

    升级PORT插件,在无法创建Raw Socket时改为使用标准TCP连接方式检测开放端口。 X-Scan v1.1 -- 发布日期:11/25/2001,将所有检测功能移入插件,使主程序完全成为“容器”;提供多语言支持;更新图形接口程序;...

    cmd操作命令和linux命令大全收集

    tftp -i 自己IP(用肉机作跳板时这用肉机IP) get server.exec:server.exe 登陆后,将“IP”的server.exe下载到目标主机c:server.exe 参数:-i指以二进制模式传送,如传送exe文件时用,如不加-i 则以ASCII模式(传送...

    X-Scan

    -port : 检测常用服务的端口状态 -ftp : 检测FTP弱口令 -pub : 检测FTP服务匿名用户写权限 -pop3 : 检测POP3-Server弱口令 -smtp : 检测SMTP-Server漏洞 -sql : 检测SQL-Server弱口令 -smb ...

    强大的扫描工具x-scan

    升级PORT插件,在无法创建Raw Socket时改为使用标准TCP连接方式检测开放端口。 X-Scan v1.1 -- 发布日期:11/25/2001,将所有检测功能移入插件,使主程序完全成为“容 器”;提供多语言支持;更新图形接口程序;...

    java 面试题 总结

    内存处理是编程人员容易出现问题的地方,忘记或者错误的内存回收会导致程序或系统的不稳定甚至崩溃,Java提供的GC功能可以自动监测对象是否超过作用域从而达到自动回收内存的目的,Java语言没有提供释放已分配内存的...

    ASP.NET的网页代码模型及生命周期

    q 当一部分页面出现错误不会影响到其他的页面或功能。 q 不需要项目文件,可以把一个目录当作一个Web应用来处理。 总体来说,ASP.NET网站适用于较小的网站开发,因为其动态编译的特点,无需整站编译。而ASP.NET应用...

    虚拟主机管理(功能强大,全面,智能)

    虚拟主机系统是针对网络公司销售域名、主机、邮局、数据库等产品时效率低、管理难等问题而自主研发的集产品自动化开通、管理、续费、升级等功能为一体的软件系统。通过多年的改进与运作,软件已具有功能强大、安全...

    EasyHost虚拟主机管理 v3.0.rar

    EasyHost虚拟主机系统是针对网络公司销售域名、主机、邮局、数据库等产品时效率低、管理难等问题而自主研发的集产品自动化开通、管理、续费、升级等功能为一体的软件系统。通过多年的改进与运作,软件已具有功能强大...

    需要一些技巧来创建一些体系结构,以便在其中可以将数据库和代码保留在不同的服务器上?

    嗨,这可能是由于权限问题引起的,请为IIS用户提供完全访问权限,并且您可能不会收到此错误。甚至继续发生。请检查天气,您已将sql服务器配置为允许相应的远程连接。请看一下这个...

    网管教程 从入门到精通软件篇.txt

    Windows XP(包括 Windows 2000)的控制台命令是在系统出现一些意外情况下的一种非常有效的诊断和测试以及恢复系统功能的工具。小编的确一直都想把这方面的命令做个总结,这次辛苦老范给我们整理了这份实用的秘笈。 ...

Global site tag (gtag.js) - Google Analytics