我在下面一段代码中暴出异常
public bool Open()
{
try
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
return true;
}
catch (Exception ex)
{
throw new Exception(ConnectError);
}
}MESSAGE:
句柄无效。 (异常来自 HRESULT:0x80070006 (E_HANDLE))StackTrace:
在System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
在 System.Data.OracleClient.OracleConnection.Open()
在 CardServer.DataBase.DB.Open() 位置 ****(省略)****:行号 43Source:mscorlib
当时连接Connection状态:Closed
补充说明:这个异常只是时不时会发生,平均1~2天就会有,而且发生后会接着连续几次连接都失败。我可以保证几点:1,我的数据库操作完后连接肯定有关闭。2,我的连接字符串绝对没问题。3,发生时数据库的最大连接值没有到上限。4,发生时我查了下数据库中上面程序的连接SESSION是只有一条的,为INACTIVE状态。大家帮帮忙,这个问题困扰我一个多月了,之前发了几个贴都没人提到要点。先谢谢大家了~~
public bool Open()
{
try
{
if (conn.State == ConnectionState.Closed)
{
conn.Open();
}
return true;
}
catch (Exception ex)
{
throw new Exception(ConnectError);
}
}MESSAGE:
句柄无效。 (异常来自 HRESULT:0x80070006 (E_HANDLE))StackTrace:
在System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
在 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
在 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
在 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
在 System.Data.OracleClient.OracleConnection.Open()
在 CardServer.DataBase.DB.Open() 位置 ****(省略)****:行号 43Source:mscorlib
当时连接Connection状态:Closed
补充说明:这个异常只是时不时会发生,平均1~2天就会有,而且发生后会接着连续几次连接都失败。我可以保证几点:1,我的数据库操作完后连接肯定有关闭。2,我的连接字符串绝对没问题。3,发生时数据库的最大连接值没有到上限。4,发生时我查了下数据库中上面程序的连接SESSION是只有一条的,为INACTIVE状态。大家帮帮忙,这个问题困扰我一个多月了,之前发了几个贴都没人提到要点。先谢谢大家了~~
解决方案 »
- 今天自学看书遇到的问题,请高手们进来帮助!!
- Response.Write("<script>alert(\"请输入试验重量!\")</script>"); 无法弹出对话框
- 关于RDLC报表中数据集使用的作用
- .NET Winform如何将汉字编码成URL代码?
- 菜鸟关于多线程调用窗体控件的问题,紧急求助
- 都问了很多的问题:c#2005中如何让用户在程序中设置“设置文件”也就是.settings的文件
- c# 如何用右键选中dataGridView的单元格
- Server.Transfer的问题,如何在Transfer过程中保持url不变.
- 再线等 - 怎样用C#制作CHM文件
- vs2013的窗体中调用dll记载代码写在什么位置合适?
- Application.Exit()没有退出程序
- 将Matrix矩阵转换为Vector3坐标
可是为什么没见其他人用ORACLECLIENT有这个问题