我如何找到导致我的交易升级的原因?

发布于 2024-08-29 11:13:44 字数 722 浏览 6 评论 0原文

我有一个提供 Web 服务(.asmx 和 WCF 的混合)的网站,该网站主要使用 LINQ to SQL 和 System.Transactions。有时,我们会看到事务被提升为分布式事务,这会导致问题,因为我们的 Web 服务器与数据库隔离,导致我们无法使用 MSDTC。

我通过将以下内容添加到 web.config 来配置 System.Transactions 的跟踪:

<system.diagnostics>
  <sources>
    <source name="System.Transactions" switchValue="Information">
      <listeners>
        <add
          name="tx"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData="tx.log"
          />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

这非常有趣,并在事务被提升时向我显示,但我发现它并不能真正帮助发现原因。

ADO.NET 是否有等效的跟踪机制,可以在创建连接时向我显示,包括影响池的变量(用户、cnn 字符串、事务范围)?

I have web site which serves web services (a mixture of .asmx and WCF) which is mostly using LINQ to SQL and System.Transactions. Occaisionally we see the transaction get promoted to a distributed transaction which causes problems because our web servers are isolated from our databases in such a way that it is not possible for us to use MSDTC.

I have configured tracing for System.Transactions by adding the following to my web.config:

<system.diagnostics>
  <sources>
    <source name="System.Transactions" switchValue="Information">
      <listeners>
        <add
          name="tx"
          type="System.Diagnostics.XmlWriterTraceListener"
          initializeData="tx.log"
          />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

It's very interesting and shows me when the transaction is promoted, but I find that it doesn't really help be discover why.

Is there an equivalent tracing mechanism for ADO.NET that will show me when connections are created, including the variables that affect pooling (user, cnn string, transaction scope)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

我为君王 2024-09-05 11:13:44

您可以查看 SQL Server 中的数据访问跟踪2005(那里还有一个 SQL Server 2008 版本的链接)。该文章介绍了如何配置跟踪以及如何读取生成的文件。我不确定它是否会给你你想要的东西,但它肯定会显示连接/连接字符串。缺点是会产生大量输出。

另一种选择是运行 SQL Server Profiler 或服务器端跟踪捕获连接、SQL 语句和事务。

You could take a look at Data Access Tracing in SQL Server 2005 (there is also a link to the SQL Server 2008 version there). That article describes how to configure tracing and how to read the generated files. I'm not sure if it will give you exactly what you want but it will definitely show the connections/connection strings. On the downside, there is a lot of output generated.

Another option would be to run SQL Server Profiler or server-side trace to capture connections, SQL statements and transactions.

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