2008-09-10 40 views
1

以下例外可能是什麼原因?爲什麼當前平臺不支持'資源池'?

System.PlatformNotSupportedException: 'ResourcePool' is not supported on the current platform. 
    at System.EnterpriseServices.Platform.Assert(Boolean fSuccess, String function) 
    at System.EnterpriseServices.Platform.Assert(Version platform, String function) 
    at System.EnterpriseServices.ResourcePool..ctor(TransactionEndDelegate cb) 
    at System.Data.SqlClient.ConnectionPool..ctor(DefaultPoolControl ctrl) 
    at System.Data.SqlClient.PoolManager.FindOrCreatePool(DefaultPoolControl ctrl) 
    at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) 
    at System.Data.SqlClient.SqlConnection.Open() 

該平臺是Windows 2003 Server SP2。在Windows XP SP2上相同的代碼已經過測試,沒有任何問題。但是,不管平臺如何,知道導致此異常的原因是很有趣的。

回答

1

我已經戳了使用Reflector的源代碼,我似乎無法在ResourcePool的靜態構造函數中找到對Platform.Assert的任何調用。

是Windows 2003服務器64位?這可能是問題所在。

+0

您必須加載Reflector中的System.EnterpriseServices。 ResourcePool的構造函數包含以下行: Platform.Assert(Platform.W2K,「ResourcePool」); 這並不回答問題,但至少我們有例外的來源。 – csgero 2008-10-07 08:15:00