代码在我的这台机上,数据库在局域网中的另一台机上(和我的机器一样:XP SP2+瑞星)机器上都装有SQL2000和VS2005 没有SQL2005运行报如下错误(两个错误):
(1)
“/Web”应用程序中的服务器错误。
--------------------------------------------------------------------------------在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)源错误:
行 335: {
行 336: //connection.Close();
行 337: throw new Exception(e.Message);
行 338: }
行 339: finally
源文件: D:\DZGL\DBUtility\DbHelperSQL.cs 行: 337 堆栈跟踪:
[Exception: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)]
DBUtility.DbHelperSQL.GetSingle(String SQLString) in D:\DZGL\DBUtility\DbHelperSQL.cs:337
DBUtility.DbHelperSQL.Exists(String strSql) in D:\DZGL\DBUtility\DbHelperSQL.cs:51
DAL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\DAL\Common\Common.cs:270
BLL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\BLL\Common\Common.cs:117
Login.ImgLogin_ServerClick(Object sender, ImageClickEventArgs e) in d:\DZGL\Web\Login.aspx.cs:28
System.Web.UI.HtmlControls.HtmlInputImage.OnServerClick(ImageClickEventArgs e) +75
System.Web.UI.HtmlControls.HtmlInputImage.RaisePostBackEvent(String eventArgument) +91
System.Web.UI.HtmlControls.HtmlInputImage.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4886
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
(2)“/DZGL”应用程序中的服务器错误。
--------------------------------------------------------------------------------超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。源错误:
行 319: {
行 320: try
行 321: {
行 322: //cmd.CommandTimeout = 180;
行 323: connection.Open();
源文件: D:\DZGL\DBUtility\DbHelperSQL.cs 行: 321 堆栈跟踪:
[InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +1261381
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
DBUtility.DbHelperSQL.GetSingle(String SQLString) in D:\DZGL\DBUtility\DbHelperSQL.cs:321
DBUtility.DbHelperSQL.Exists(String strSql) in D:\DZGL\DBUtility\DbHelperSQL.cs:51
DAL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\DAL\Common\Common.cs:280
BLL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\BLL\Common\Common.cs:117
Login.ImgLogin_ServerClick(Object sender, ImageClickEventArgs e) +173
System.Web.UI.HtmlControls.HtmlInputImage.OnServerClick(ImageClickEventArgs e) +105
System.Web.UI.HtmlControls.HtmlInputImage.RaisePostBackEvent(String eventArgument) +91
System.Web.UI.HtmlControls.HtmlInputImage.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433 在网上试了好多方法都不行,很急啊,希望能够得到大家的帮忙,谢谢了
(1)
“/Web”应用程序中的服务器错误。
--------------------------------------------------------------------------------在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Exception: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)源错误:
行 335: {
行 336: //connection.Close();
行 337: throw new Exception(e.Message);
行 338: }
行 339: finally
源文件: D:\DZGL\DBUtility\DbHelperSQL.cs 行: 337 堆栈跟踪:
[Exception: 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: 命名管道提供程序, error: 40 - 无法打开到 SQL Server 的连接)]
DBUtility.DbHelperSQL.GetSingle(String SQLString) in D:\DZGL\DBUtility\DbHelperSQL.cs:337
DBUtility.DbHelperSQL.Exists(String strSql) in D:\DZGL\DBUtility\DbHelperSQL.cs:51
DAL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\DAL\Common\Common.cs:270
BLL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\BLL\Common\Common.cs:117
Login.ImgLogin_ServerClick(Object sender, ImageClickEventArgs e) in d:\DZGL\Web\Login.aspx.cs:28
System.Web.UI.HtmlControls.HtmlInputImage.OnServerClick(ImageClickEventArgs e) +75
System.Web.UI.HtmlControls.HtmlInputImage.RaisePostBackEvent(String eventArgument) +91
System.Web.UI.HtmlControls.HtmlInputImage.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4886
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433
(2)“/DZGL”应用程序中的服务器错误。
--------------------------------------------------------------------------------超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。源错误:
行 319: {
行 320: try
行 321: {
行 322: //cmd.CommandTimeout = 180;
行 323: connection.Open();
源文件: D:\DZGL\DBUtility\DbHelperSQL.cs 行: 321 堆栈跟踪:
[InvalidOperationException: 超时时间已到。超时时间已到,但是尚未从池中获取连接。出现这种情况可能是因为所有池连接均在使用,并且达到了最大池大小。]
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +1261381
System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +105
System.Data.SqlClient.SqlConnection.Open() +111
DBUtility.DbHelperSQL.GetSingle(String SQLString) in D:\DZGL\DBUtility\DbHelperSQL.cs:321
DBUtility.DbHelperSQL.Exists(String strSql) in D:\DZGL\DBUtility\DbHelperSQL.cs:51
DAL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\DAL\Common\Common.cs:280
BLL.Common.Common.Login(String userid, String password, String IP) in D:\DZGL\BLL\Common\Common.cs:117
Login.ImgLogin_ServerClick(Object sender, ImageClickEventArgs e) +173
System.Web.UI.HtmlControls.HtmlInputImage.OnServerClick(ImageClickEventArgs e) +105
System.Web.UI.HtmlControls.HtmlInputImage.RaisePostBackEvent(String eventArgument) +91
System.Web.UI.HtmlControls.HtmlInputImage.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
--------------------------------------------------------------------------------
版本信息: Microsoft .NET Framework 版本:2.0.50727.1433; ASP.NET 版本:2.0.50727.1433 在网上试了好多方法都不行,很急啊,希望能够得到大家的帮忙,谢谢了
开始-程序-Microsoft SQL server 2005-配置工具-sql server外围应用配置器
选择“服务连接的外围配置器"里面有个远程连接
首先要测试Web服务器上的SQL2000查询分析器可以正常通过内网IP和SA帐号访问你的SQL服务器。
其次再检查.net项目中的连接字符串是否正确。
<add name="ConnectionString" connectionString="Data Source=192.168.1.10;Initial Catalog=DZGL;User ID=sa;Password=sa;pooling=true;max pool size=200;min pool size=1;timeout=30" providerName="System.Data.SqlClient"/>
数据库操作没有释放连接..
先在IIS中把应用程序池停止,再起动..
然后查程序..
http://hi.baidu.com/%BB%A8%D1%A9%C8%E7%C3%CE/blog/item/eac6ff17cd6df601c93d6df8.html2)是数据库连接池满了..需要在程序中检查哪块没有释放数据库连接..
应急解决办法..重启IIS中网站应用程序所用的应用程序池
数据库操作的时候:try
{
connection.Open();
//数据库的select,update,insert,delete操作
}
catch{}
{
throw new Exception(e.Message);
}
finally
{
connection.Close();
}