TransactionManager.MaximumTimeout是个只读的属性, 默认只有10分钟, 要想修改它必须通过machine.config来修改. 为了单个应用而去修改这个值是不合适的. stackoverflow.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 (RTM)

    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/network transactions. 该伙伴事务管理器已经禁止了它对远程/网络事务

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

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

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

  6. The partner transaction manager has disabled its support for remote/network transactions.

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

  7. Understanding JDBC Internals & Timeout Configuration

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

  8. Ehcache(2.9.x) - API Developer Guide, 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. 基于ffmpeg的流媒体服务器

    OS:ubuntu 12.04ffmpeg:N-47141-g4063bb2x264:0.133.2334 a3ac64b目标:使用ffserver建立流媒体服务器使用ffmpeg对本地文件流化(x2 ...

  2. 【转】linux中waitpid及wait的用法

    原文网址:http://www.2cto.com/os/201203/124851.html wait(等待子进程中断或结束) 表头文件      #include<sys/types.h> ...

  3. Oracle 课程五之优化器和执行计划

    课程目标 完成本课程的学习后,您应该能够: •优化器的作用 •优化器的类型 •优化器的优化步骤 •扫描的基本类型 •表连接的执行计划 •其他运算方式的执行计划 •如何看执行计划顺序 •如何获取执行计划 ...

  4. 为redis分配一个新的端口

    为redis分配一个8888端口,操作步骤如下:1.$REDIS_HOME/redis.conf重新复制一份,重命名为redis8888.conf.2.打开redis8888.conf配置文件,找到p ...

  5. String.valueOf()

    1. 由 基本数据型态转换成 String String 类别中已经提供了将基本数据型态转换成 String 的 static 方法 也就是 String.valueOf() 这个参数多载的方法 有下 ...

  6. IOS文章地址暂时记录

    动画  http://www.jianshu.com/p/1c6a2de68753 iOS App性能优化  http://www.hrchen.com/2013/05/performance-wit ...

  7. Myeclipse8.5 svn插件安装两种方式

    第一种方式:(亲测成功)第一步:准备插件包:site-1.6.18.zip解压该包里面有features和plugins文件夹,删除该包里面的xml结尾的文件. 第二:我的Myeclipse8.5安装 ...

  8. 在/proc文件系统中增加一个目录hello,并在这个目录中增加一个文件world,文件的内容为hello world

    一.题目 编写一个内核模块,在/proc文件系统中增加一个目录hello,并在这个目录中增加一个文件world,文件的内容为hello world.内核版本要求2.6.18 二.实验环境 物理主机:w ...

  9. MVC中CheckBox

    一.单个Checkbox 1.View文件 <%= Html.CheckBoxFor(model => model.IsNeverExpired)%> 2.生成的HTML为 < ...

  10. codeforce 702E Analysis of Pathes in Functional Graph RMQ+二进制

    http://codeforces.com/contest/702 题意:n个点,n条边,每个点出边只有一条,问从每个点出发经过k条边的边权和,以及边权最小值 思路: f[i][j] 第i个点出发,经 ...