Transaction Manager Maximum Timeout

时间:2022-09-01 12:26:51

TransactionManager.MaximumTimeout是个只读的属性, 默认只有10分钟, 要想修改它必须通过machine.config来修改. 为了单个应用而去修改这个值是不合适的. *.com上是给出的解释都是修改machine.config来完成的.

下面我给出一种单个应用独立解决的办法, 方法很简单就是修改这个只读属性.

先通用你自己的工具查看一下代码实现, 我这里是用Reshaper通过从微软那里下载下来的.

/// <summary>
/// Gets the default maximum timeout interval for new transactions.
/// </summary>
///
/// <returns>
/// A <see cref="T:System.TimeSpan"/> value that specifies the maximum timeout interval that is allowed when creating new transactions.
/// </returns>
public static TimeSpan MaximumTimeout
{
get
{
if (!TransactionManager._platformValidated)
TransactionManager.ValidatePlatform();
if (DiagnosticTrace.Verbose)
MethodEnteredTraceRecord.Trace(SR.GetString("TraceSourceBase"), "TransactionManager.get_DefaultMaximumTimeout");
if (!TransactionManager._cachedMaxTimeout)
{
lock (TransactionManager.ClassSyncObject)
{
if (!TransactionManager._cachedMaxTimeout)
{
TransactionManager._maximumTimeout = TransactionManager.MachineSettings.MaxTimeout;
TransactionManager._cachedMaxTimeout = true;
}
}
}
if (DiagnosticTrace.Verbose)
MethodExitedTraceRecord.Trace(SR.GetString("TraceSourceBase"), "TransactionManager.get_DefaultMaximumTimeout");
return TransactionManager._maximumTimeout;
}
}

看上去只要读取一些Config文件然后修改_maximumTimeout这个就可以了.实现代码如下:

    private static void ChangeTransactionManagerMaximumTimeout()
{
var customMaximumTimeout = TimeSpan.MaxValue;
var maximumTimeout = TransactionManager.MaximumTimeout; FieldInfo fieldInfo = typeof(TransactionManager).GetFields(BindingFlags.NonPublic | BindingFlags.Static).Single(item => item.Name == "_maximumTimeout");
fieldInfo.SetValue(null, customMaximumTimeout);
maximumTimeout = TransactionManager.MaximumTimeout;
}

这样在以后程序内部再次调用TransactionManager.MaximumTimeout就是修改过的timeout了.

Transaction Manager Maximum Timeout的更多相关文章

  1. How to SetUp The Receiving Transaction Manager

    In this Document   Goal   Solution   References APPLIES TO: Oracle Inventory Management - Version: 1 ...

  2. How Many Processes Should Be Set For The Receiving Transaction Manager &lpar;RTM&rpar;

    In this Document   Goal   Solution   References APPLIES TO: Oracle Inventory Management - Version 10 ...

  3. hive的事物性 transaction manager

    create table lk3 (id string,nname string,grade int,goldUser int); insert into lk3 values (,, ), (,, ...

  4. transaction manager has disabled its support for remote&sol;network transactions&period; 该伙伴事务管理器已经禁止了它对远程&sol;网络事务

    最近再用SSIS做数据归档,里面用到了分布式事务.在开发阶段是在一台计算机上运行只要是启动分布式服务就没什么问题,可是昨天把它部署到uat的时候遇到问题,错误信息是: 最后找到解决方案: 确认&quo ...

  5. 部署K2 Blackpearl流程时出错(与基础事务管理器的通信失败或Communication with the underlying transaction manager has failed&period;

    转:http://www.cnblogs.com/dannyli/archive/2011/12/01/2270222.html 亲,在部署K2流程是,是否遇到这个错误(以下是中.英文错误信息) 中文 ...

  6. The partner transaction manager has disabled its support for remote&sol;network transactions&period;

    http://technet.microsoft.com/en-us/library/cc753510(WS.10).aspx

  7. Understanding JDBC Internals &amp&semi; Timeout Configuration

    原版:http://www.cubrid.org/blog/dev-platform/understanding-jdbc-internals-and-timeout-configuration 中文 ...

  8. Ehcache&lpar;2&period;9&period;x&rpar; - API Developer Guide&comma; Transaction Support

    About Transaction Support Transactions are supported in versions of Ehcache 2.0 and higher. The 2.3. ...

  9. spring Transaction Management --官方

    原文链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html 12.  ...

随机推荐

  1. Java集合之ArrayList和LinkedList的实现原理以及Iterator详解

    ArrayList实现可变数组的原理: 当元素超出数组内容,会产生一个新数组,将原来数组的数据复制到新数组中,再将新的元素添加到新数组中. ArrayList:是按照原数组的50%来延长,构造一个初始 ...

  2. LINQ to Entities 不支持 LINQ 表达式节点类型&OpenCurlyDoubleQuote;Invoke”

    解决方法即 where后加 .Compile()

  3. 【HDOJ 2150】线段交叉问题

    Pipe Time Limit : 1000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submissi ...

  4. 【NO&period;3-1】Jmeter - 在Windows配置HOSTS的方法

    在Windows配置HOSTS 那么还记得Windows如何修改HOSTS文件吗? (1) 进入到C:\Windows\System32\drivers\etc (2) 通过”记事本”来打开hosts ...

  5. &equals;&equals;还款-代偿(csv循环自动代偿)

    问题: 解决:传递参数错误,上一步就错了 问题:代偿返回这些信息 解决:传递参数错误,应该为${repayWay1},但是一直写的是${repayWay} 问题:如何从csv文件中逐条取项目编号,进行 ...

  6. postgres 11 单实例最大支持多少个database&quest;

    有人在pg8时代(10年前)问过,当时说10000个没问题,而且每个db会在/base下建立1个文件夹, 文件ext3只支持32000个子文件夹,所以这是上限了. 而现在早就ext4了,根本没有限制了 ...

  7. 事件对象的属性,基于jQuery&lpar;jquery针对不同浏览器进行了兼容性的封装&rpar;

    1. event.type(该方法是获取到事件的类型) $( 'a' ).click( function( event ){ alert( event.type ); //click return f ...

  8. Deuteronomy

    You should choose the right path when you can choose, and you should choose the right path even if y ...

  9. android关闭日志

    我们在开发时,经常会输出各种日志来debug代码.但是等到应用发布的apk运行时不希望它输出日志. 关闭输出日志Log.v(),Log.i(),Log.w(),Log.v(),Log.e()等 原理: ...

  10. linux 搭建svn&lpar;待完成&rpar;

    http://blog.csdn.net/lazy_cc/article/details/8726500搭建仓库 http://blog.csdn.net/xocoder/article/detail ...