从Machine.config中maxTimeout价值不是由C#winform应用程序回升 [英] maxTimeout value from Machine.Config is not picked up by C# winform app

查看:565
本文介绍了从Machine.config中maxTimeout价值不是由C#winform应用程序回升的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在与Oracle 10g数据库一个winform应用程序,它使用的TransactionScope ,并希望修改 maxTimeOut machine.config中文件中指定的值,我的 machine.config中文件是在以下位置(我使用.NET 4为这个应用程序)

I have been working on a winform app with Oracle 10g database which is using TransactionScope and wanted to modify the maxTimeOut value specified in machine.config file, my machine.config file is in the following location (I am using .net 4 for this app)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config 

本来有不适合 maxTimeOut 在它指定的任何东西,因此它默认为10分钟。为了改变它,我已经添加了 maxTimeout =00:00:10值,如下图所示:

Originally there was not anything specified for maxTimeOut in it, therefore it defaults to 10 minutes. In order to change it I have added the maxTimeout="00:00:10" value as seen below:

    <sectionGroup name="system.transactions" type="System.Transactions.Configuration.TransactionsSectionGroup, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null">
        <section name="defaultSettings" type="System.Transactions.Configuration.DefaultSettingsSection, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null"/>
        <section name="machineSettings" type="System.Transactions.Configuration.MachineSettingsSection, System.Transactions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Custom=null" allowDefinition="MachineOnly" allowExeDefinition="MachineOnly" maxTimeout="00:00:10"/>
    </sectionGroup>



我已经重新启动电脑和运行测试,历时比这更长 - 但成交没有出现10秒,而不是 scopeOption.TimeOut 值(即5分钟)TransactionScopeOption参数中指定的使用量和交易时间后,中止了5分钟后。

I have restarted the PC and ran a test that lasted longer than this - but the transaction does not appear to abort after 10 seconds, instead the scopeOption.TimeOut value (which is 5 min) specified in TransactionScopeOption parameter is used and the transaction times out after 5 minutes.

我已经包括maxTimeout值成以上正确的地方?有什么需要更改文件中?为什么maxTimeout从machine.config中未使用的价值?

Have I included the maxTimeout value into the right place above? Is there anything that needs changing in the file? Why is the value of maxTimeout from machine.config not being used?

感谢

推荐答案

这不是拿起是因为maxTimeOut值应在machine.config文件的末尾刚刚闭幕的配置标记之前放置的原因。 。只要我有这种方式,它开始工作做了

The reason it was not picked up was because the maxTimeOut value should be placed at the end of the machine.config file just before the closing configuration tag. As soon as I have done it this way it started working.

 <system.transactions>
   <machineSettings maxTimeout="01:00:00" />
 </system.transactions>
</configuration> 

这篇关于从Machine.config中maxTimeout价值不是由C#winform应用程序回升的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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