这是我的 32 位 .net 应用程序连接到 sql server 时偶尔出现的随机错误。
System.ApplicationException: A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
at System.Threading.TimerBase.AddTimerNative(Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.TimerBase.AddTimer(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int32 dueTime, Int32 period)
at System.Data.ProviderBase.DbConnectionPool.CreateCleanupTimer()
at System.Data.ProviderBase.DbConnectionPool.Startup()
at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup)
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 System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
该System.Threading.TimerBase.AddTimerNative()
方法是内部调用,请参阅Microsoft 源代码。
我在网上找到了另一个讨论 CLR 的链接 CLR 是否在内部产生一个线程来响应计时器事件?
由于我不知道如何AddTimerNative
实现,因此我不知道解决此错误的原因。