SqlConnection 和 TransactionScope 超时 [英] SqlConnection and TransactionScope Timeout

查看:41
本文介绍了SqlConnection 和 TransactionScope 超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个超时为 60 分钟的 TransactionScope(通过 DTC,读取已提交).在 TransactionScope 中,我打开了连接(我希望加入事务)但 30 秒后我超时.

I have a TransactionScope (over DTC, read committed) with a timeout of 60 minutes. In the TransactionScope I have opened the connection (I hope to enlist in the transaction) but after 30 seconds I get a timeout.

在 machine.config 中,我将 system.transaction maxTimeout 更改为 60 分钟.

In the machine.config I changed the system.transaction maxTimeout to 60 minutes.

为什么 30 秒后超时?

Why does the timeout occur after 30 seconds?

推荐答案

SqlCommand 已经具有默认为 30 秒的 CommandTimeout 属性.可能是您在交易中使用它.

A SqlCommand already has a CommandTimeout property that defaults to 30 seconds. May be you are using it within your transaction.

这篇关于SqlConnection 和 TransactionScope 超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆