关于System.Runtime.InteropServices.COMException (0x80070006): 句柄无效的问题
来源:互联网 发布:什么约会软件好 编辑:程序博客网 时间:2024/05/29 19:00
今天发生一个意外情况。情况是这样的:
本地开发环境下,运行网站,在某个画面里进行数据检索,刚开始没有问题,在测试分页按钮“末页”时,出现状况,无法检索数据,并且之后查看其他页面时,只要与数据库有关的操作,都无法正常操作。
之后查看了日志,显示以下的错误信息:
System.Runtime.InteropServices.COMException (0x80070006): 句柄无效。 (异常来自 HRESULT:0x80070006 (E_HANDLE))在 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.SqlClient.SqlConnection.Open()
多次出现以上异常信息后,又出现以下信息:
System.UnauthorizedAccessException: 拒绝访问。 (异常来自 HRESULT:0x80070005 (E_ACCESSDENIED))
在 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.SqlClient.SqlConnection.Open()
之前的开发测试过程中从未出现,所以认为两个异常应该是同一个原因造成的,之后通过GOOGLE,找到一MSDN论坛帖,贴主和我有类似的情况,并且最后表示问题已经解决。具体内容:
问题:
Hi,
I got the following errors in our C# Windows application:
1. Type : System.Runtime.InteropServices.COMException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))
Source : mscorlib
Help link :
ErrorCode : -2147024890
Data : System.Collections.ListDictionaryInternal
TargetSite : Void ThrowExceptionForHRInternal(Int32, IntPtr)
Stack Trace : at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode)
at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.OpenConnection()
at Microsoft.Practices.EnterpriseLibrary.Data.Database.ExecuteNonQuery(DbCommand command)
2. Type : System.UnauthorizedAccessException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
3. Type : System.Threading.SemaphoreFullException, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : Adding the given count to the semaphore would cause it to exceed its maximum count.
Note:
1. We are using Microsoft Enterprise Library 2006 Data Access & Exception Application Blocks in our application.
2. We are using a method save each action(Journal Entry) of the application into a database which can be as frequent as fraction of a second
An early solution to this will be a helpful one.
解决方案:
Hi All,
I got the solution for this.
Include 'Min Pool Size =1' in the connection string.
参照:http://social.msdn.microsoft.com/Forums/vstudio/zh-CN/bca55280-e49b-4e5c-8c39-3933ed7f3a54/the-handle-is-invalid-exception-from-hresult-0x80070006-ehandle
- 关于System.Runtime.InteropServices.COMException (0x80070006): 句柄无效的问题
- 关于system.runtime.interopservices.comexception(0x800A1066)的问题
- 解决System.Runtime.Interopservices.COMException问题
- 解决System.Runtime.Interopservices.COMException问题
- 错误:system.runtime.interopservices.comexception (0x80040154)
- System.Runtime.InteropServices.COMException (0x80028018):
- System.Runtime.InteropServices.COMException (0x800A03EC)
- System.Runtime.InteropServices.COMException (0x80010105): 服务器出现意外情况 问题的解决
- “System.Runtime.InteropServices.COMException”解决之道
- System.Runtime.InteropServices.COMException解决办法
- System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800AC472
- WIN7SP1 Crystal Reports异常:System.Runtime.InteropServices.ComException(0x800003E7)
- System.Runtime.InteropServices.COMException 6/2
- Visual Studio 2008 System.Runtime.InteropServices.COMException
- win7+VS2008 System.Runtime.InteropServices.COMException
- 文档管理系统 之一 doc、xls、ppt文档转换成html及System.Runtime.InteropServices.COMException (0x80004005): 360的问题
- 文档管理系统 之一 doc、xls、ppt文档转换成html及System.Runtime.InteropServices.COMException (0x80004005): 360的问题
- Asp.Net操作Word内容“System.Runtime.InteropServices.COMException: 命令失败”的解决方法
- 什么是正能量?怎样做一位正能量的人?
- WinCE手写输入法
- Linux内核完全注释
- [oracle10g]dbca创建数据库时processes参数的最小取值
- wikioi p1116 四色问题
- 关于System.Runtime.InteropServices.COMException (0x80070006): 句柄无效的问题
- wikioi p1294 全排列
- QT APP实战-图片播放器
- WinCE T9输入法 (支持拼音、手写、笔画、英文,可定制功能)
- wikioi p1295 N皇后问题
- Run JavaScript files on the server side
- js处理json和字符串示例
- Android在OnCreate中获取控件的宽度和高度
- MySql常用语句