2008-09-10 41 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