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. Nginx & AWStats 安装、配置、使用

    —— 参考IBM文章:THIS , 不一样的指导顺序 —— 1. awstats分析nginx - access.log,网上资料大部分都是下载,然后配置.官网下载地址: http://awstats ...

  2. 查看ORACLE执行计划的几种常用方法

    SQL的执行计划实际代表了目标SQL在Oracle数据库内部的具体执行步骤,作为调优,只有知道了优化器选择的执行计划是否为当前情形下最优的执行计划,才能够知道下一步往什么方向. 执行计划的定义:执行目 ...

  3. 最好最实用的PHP二次开发教程

    ◆二次开发 1.什么是二次开发? 二次开发,简单的说就是在现有的软件上进行定制修改,功能的扩展,然后达到自己想要的功能和效果,一般来说都不会改变原有系统的内核. 2.为什么要二次开发? 随着信息化技术 ...

  4. linux下利用backtrace追踪函数调用堆栈以及定位段错误

    一般察看函数运行时堆栈的方法是使用GDB(bt命令)之类的外部调试器,但是,有些时候为了分析程序的BUG,(主要针对长时间运行程序的分析),在程序出错时打印出函数的调用堆栈是非常有用的. 在glibc ...

  5. ZOJ 3879 Capture the Flag

    以此题纪念我写的第一篇acm博客,第一道模拟:) http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3879 题意非常复杂,感觉 ...

  6. delphi ole word

    源代码如下: //Word打印(声明部分) wDoc,wApp:Variant; function PrnWordBegin(tempDoc,docName:String):boolean; func ...

  7. IOS 通知 alarm 记录

    所有的内容融为一体,去除某一个项不知道结果如何. 最主要的前提:APP 会长期保留在后台 1.在info.plist 文件里面,加入 audio 后台请求 2.当APP 点击home进入后台之后,请求 ...

  8. Android的Eclipse升级笔记

    Eclipse优化: 1.可以删除的插件有: EGit CVS Mylyn cdt 1.不用多次加载布局容器的版本: ADT-22.3.0 adt-bundle-windows-x86-2013103 ...

  9. 常用SQL语句汇总整理

    1.SQL 插入语句得到自动生成的递增ID 值 insert into Table1(Name,des,num) values (''ltp'',''thisisbest'',10); select ...

  10. C++程序设计之结构体,共用体,枚举和typedef

    [1]结构体的基本功 注意结构体里面可以有很多东西,可以结构体里面包含结构体 #include<iostream> using namespace std; struct Date { i ...