We randomly get the following exceptions:

[COMException (0x80070006): The handle is invalid. (Exception from HRESULT:
0x80070006 (E_HANDLE))]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) +0
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32
errorCode) +34
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +636
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) +86


and

[UnauthorizedAccessException: Access is denied. (Exception from HRESULT:
0x80070005 (E_ACCESSDENIED))]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32
errorCode, IntPtr errorInfo) +0
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32
errorCode) +34
System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection
owningObject) +636
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) +86


Before the Access Denied exception is thrown, the user is prompted for
credentials - none work, not even admin.



Also, occasionally, pooling will throw a SemaphoreFullException:

[SemaphoreFullException: Adding the given count to the semaphore would cause
it to exceed its maximum count.]
System.Threading.Semaphore.Release(Int32 releaseCount) +1853063

System.Data.ProviderBase.DbConnectionPool.PutNewObject(DbConnectionInternal
obj) +54

System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInternal obj) +228
System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal
obj, Object owningObject) +265

System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection
owningObject, DbConnectionFactory connectionFactory) +97
System.Data.SqlClient.SqlConnection.Close() +117
System.Data.Common.DbDataAdapter.QuietClose(IDbConnection connection,
ConnectionState originalState) +13
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior) +285
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) +86




Obviously, if I turn off pooling, I don't get these exceptions - but
performance suffers noticeably.



These exceptions don't always happen. The web app will run fine for hours
before an exception is thrown. It could also be as short as the next request.
. It randomly occurs and in random places in the code. Once thrown, every
request afterwards throws the "Access Denied" exception.

Using basic connection string:
"server=xxx.xxx;database=xxx;uid=xxx;pwd=xxx;app=xxx".



I have no idea how to go about troubleshooting this. Any help or ideas would
be greatly appreciated.