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. ...
随机推荐
- UVA 1151 Buy or Build (MST最小生成树,kruscal,变形)
题意: 要使n个点之间能够互通,要使两点直接互通需要耗费它们之间的欧几里得距离的平方大小的花费,这说明每两个点都可以使其互通.接着有q个套餐可以选,一旦选了这些套餐,他们所包含的点自动就连起来了,所需 ...
- HTMLParser 解析HTML
from html.parser import HTMLParser from html.entities import name2codepoint class MyHTMLParser(HTMLP ...
- git - 搭建git仓库
1. 更新git版本: http://codelife.me/blog/2013/06/25/upgrade-git-on-centos-6-4/ 2. 建立git仓库: git init --bar ...
- 数学语言和程序语言的对比:面向过程与面向集合&命题
共同之处:都使用字符串或数值来引用一个客观实体.当然数字和字符串也可以作为实体对象,这取决于人的解释. 不同之处:数学语句每一行都给出了一个结论, 程序语句的每一行都定义了一个过程.注意这里所指的程序 ...
- LA 3708 Graveyard 墓地雕塑 NEERC 2006
在一个周长为 10000 的圆上等距分布着 n 个雕塑.现在又有 m 个新雕塑加入(位置可以随意摆放),希望所有 n + m 个雕塑能在圆周上均匀分布.这就需要移动一些原有的雕塑.要求 n 个雕塑移动 ...
- SQLlite(WebSQL)如何排序并分页查询(SQLlite语法)
SELECT * FROM Table ORDER BY ID DESC Limit 10,9 limit语义:跳过10行,取9行 参考: SQLite的limit用法 如果我要去11-20的Ac ...
- codeforces 260 div2 C题
C题就是个dp,把原数据排序去重之后得到新序列,设dp[i]表示在前i个数中取得最大分数,那么: if(a[i] != a[i-1]+1) dp[i] = cnt[a[i]]*a[i] + dp[ ...
- opencv人脸检测分类器训练小结
这两天在初学目标检测的算法及步骤,其中人脸检测作为最经典的算法,于是进行了重点研究.该算法最重要的是建立人脸检测分类器,因此我用了一天的时间来学习分类器的训练.这方面的资料很多,但是能按照一个资料运行 ...
- 《转》DNS放大攻击
原文链接:http://blog.sina.com.cn/s/blog_90bb1f200101iazl.html 放大攻击(也称为杠杆攻击,英文名字DNS Amplification Attack) ...
- php上传文件时出现错误:failed to open stream: Permission denied
尝试使用php写了一段小的上传程序,但是在使用的时候,在上传文件时出现这个错误,由于之前在写程序要读文件,曾经出现过这个问题,当时是因为要读的文件的权限不够,于是使用chmod 775 1.txt把文 ...