Transaction Manager Maximum Timeout
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的更多相关文章
- How to SetUp The Receiving Transaction Manager
In this Document Goal Solution References APPLIES TO: Oracle Inventory Management - Version: 1 ...
- 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 ...
- hive的事物性 transaction manager
create table lk3 (id string,nname string,grade int,goldUser int); insert into lk3 values (,, ), (,, ...
- transaction manager has disabled its support for remote/network transactions. 该伙伴事务管理器已经禁止了它对远程/网络事务
最近再用SSIS做数据归档,里面用到了分布式事务.在开发阶段是在一台计算机上运行只要是启动分布式服务就没什么问题,可是昨天把它部署到uat的时候遇到问题,错误信息是: 最后找到解决方案: 确认&quo ...
- 部署K2 Blackpearl流程时出错(与基础事务管理器的通信失败或Communication with the underlying transaction manager has failed.
转:http://www.cnblogs.com/dannyli/archive/2011/12/01/2270222.html 亲,在部署K2流程是,是否遇到这个错误(以下是中.英文错误信息) 中文 ...
- The partner transaction manager has disabled its support for remote/network transactions.
http://technet.microsoft.com/en-us/library/cc753510(WS.10).aspx
- Understanding JDBC Internals & Timeout Configuration
原版:http://www.cubrid.org/blog/dev-platform/understanding-jdbc-internals-and-timeout-configuration 中文 ...
- 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. ...
- spring Transaction Management --官方
原文链接:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/transaction.html 12. ...
随机推荐
- 【C#学习笔记】写文件
using System; using System.IO; namespace ConsoleApplication { class Program { static void Main(strin ...
- 【转】linux中wait与waitpid的差别
原文网址:http://blog.163.com/libo_5/blog/static/15696852010324287748/ zombie不占用内存也不占用CPU,表面上我们可以不用在乎它们的存 ...
- 【转】VI/VIM常用命令
原文网址:http://www.blogjava.net/woxingwosu/archive/2007/09/06/125193.html Vi是“Visual interface”的简称,它在Li ...
- Entity Framework 5.0
今天 VS2012 .net Framework 4.5 Entity Framework 5.0 三者共同发布了. ( EF5 Released ) 在介绍新特性之前,先与大家回顾一下EF版 ...
- [Irving]WPF Invalid character in the given encoding. Line xx, position xx.' XML is not valid.
WPF开发中发现Xaml界面中突然抽风似的提示错误 Invalid character in the given encoding. Line xx, position xx.' XML is not ...
- 仿windows phone风格主界面
使用了ZAKER到最新版本,其主界面采用windows phone的风格,感觉还蛮好看的,挺喜欢的,就模仿写了一下,实现到界面截图如下: 第一版面: 第二版面: 在实现了它到九宫格菜单,还实现了背景图 ...
- LINQ to SQL语句之Join和Order By
Join操作 适用场景:在我们表关系中有一对一关系,一对多关系,多对多关系等.对各个表之间的关系,就用这些实现对多个表的操作. 说明:在Join操作中,分别为Join(Join查询), SelectM ...
- linux 常用命令基础
linux常用的命令 shell 是命令语句,命令解释程序以及程序设计语言的统称,它不仅仅拥有自己内建的shell命令集,同时也能被系统中其他应用程序所调用 shell 的一个重要特性是它本身就是一个 ...
- MFC字体与文本输出
字体 成员函数 1.CFont( ); 构造一个CFont对象.此对象在使用之前应该先使用CreateFont.CreateFontIndirect.CreatePointFont或CreatePoi ...
- jq实现图片轮播:圆形焦点+左右控制+自动轮播
来源:http://www.ido321.com/862.html html代码: 1: <!DOCTYPE html> 2: <html lang="en"&g ...