SqlConnection.open() 抛出 TransactionException 0xe0434f4d

发布于 2024-08-18 22:21:06 字数 658 浏览 3 评论 0原文

连接到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

薄荷梦 2024-08-25 22:21:06

It looks like you are missing handling a SQLException

http://blogs.msdn.com/tess/archive/2006/04/27/584927.aspx

墨离汐 2024-08-25 22:21:06

就我而言,除了少数机器之外,部署到网络中许多 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 subkey v3.5\SP (ServicePack) is NOT at 1. 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".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文