SqlConnection.open() 抛出 TransactionException 0xe0434f4d
连接到 sql server 2005 数据库时,代码工作正常。但是当连接到 sql server 2008 数据库时它失败了。
设想: Web 服务首先连接到 2008 数据库良好。然后在 COM+ 对象中调用期间,连接失败。
最近升级项目以使用 VS2008 并升级到 Sql Server 2008。
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionTimeOut))
{
using (SqlConnection sqlConnection = new SqlConnection(DataConnection))
{
try
{
String command = "my_StoredProcedure";
using (SqlCommand sqlCommand = new SqlCommand(command, sqlConnection))
{
sqlConnection.Open(); //- exception is throw right after this call in the COM+ object.
有什么想法吗?
Code works fine when connecting to a sql server 2005 dbase. but when connecting to a sql server 2008 dbase it fails.
scenario:
Webservice first connects to 2008 dbase fine. Then during a call in a COM+ object, the connect fails.
Recently upgraded projects to use VS2008 and upgraded to Sql Server 2008.
using (TransactionScope transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionTimeOut))
{
using (SqlConnection sqlConnection = new SqlConnection(DataConnection))
{
try
{
String command = "my_StoredProcedure";
using (SqlCommand sqlCommand = new SqlCommand(command, sqlConnection))
{
sqlConnection.Open(); //- exception is throw right after this call in the COM+ object.
Any Ideas out there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您缺少处理 SQLException
http://blogs .msdn.com/tess/archive/2006/04/27/584927.aspx
It looks like you are missing handling a SQLException
http://blogs.msdn.com/tess/archive/2006/04/27/584927.aspx
就我而言,除了少数机器之外,部署到网络中许多 PC 的二进制文件都可以正常执行。代码中的所有异常均已处理,但尽管如此,
0xe0434f4d
在启动后立即抛出。该应用程序始终在本地启动(不是从网络共享),没有明显的权限问题等。该应用程序的要求包括 .NET 3.5。我检查了已安装的 .NET 版本(众所周知的注册表子树
HKLM\SOFTWARE\NET Framework Setup\NDP
),发现子项v3.5\SP
(ServicePack) 不是在1
处。这意味着已安装 .NET 3.5,但不是最新发布的版本 (SP1)。 下载 v3.5 SP1 后,安装并重新启动PC,整个问题消失了。因此,关键是“不仅仅是任何 .NET 3.5,而且必须存在最新的 .NET 3.5”。In my case, binaries deployed to many PC's in network were executed fine except of few machines. All exceptions in code were handled but despite of that,
0xe0434f4d
was thrown right after start. The app always was launched locally (not from network share), no obvious issues with permissions etc. The app had .NET 3.5 among its requirements.I examined installed .NET version (well-known registry subtree
HKLM\SOFTWARE\NET Framework Setup\NDP
) and found that subkeyv3.5\SP
(ServicePack) is NOT at1
. It means that .NET 3.5 is installed, but not the latest released version (SP1). After downloading v3.5 SP1, installing and restarting the PC, the entire problem disappeared. So the key was "not just any .NET 3.5, but latest .NET 3.5 must be present".