.NET事务时间限制

来源:互联网 发布:淘宝如何设置单件包邮 编辑:程序博客网 时间:2024/04/30 16:56
  • 默认事务时间

1分钟

  • 在web.config中设置事务时间
<configuration><system.transactions>    <defaultSettings timeout="00:20:00"/>  </system.transactions></configuration>

config中只能设置不超过10分钟的事务时间。即使设置超过10分钟,也会在10分钟时候超时

  • achine.config中设置超时时间

    路径32位:C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
    路径64位:C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config
    添加如下代码

  <system.transactions>    <machineSettings maxTimeout="00:30:00" />  </system.transactions></configuration>

这样就可以设置事务的时间为30分钟。

  • wcf中还有一个地方可以设置事务时间
<behaviors>      <serviceBehaviors>        <behavior name="WcfServiceBehavior" >          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"  />          <serviceDebug includeExceptionDetailInFaults="false" />          <serviceTimeouts transactionTimeout="10:10:00"></serviceTimeouts>        </behavior>      </serviceBehaviors>    </behaviors>
0 0
原创粉丝点击