當通過WCF net.tcp綁定運行分佈式事務時,我有一個奇怪的超時問題。恰好10分鐘後,交易總是超時。我認爲我已將所有超時設置爲比我知道的更高的值(15分鐘),但我可能忽略了某些內容。我正在調用IIS7.5中託管的WCF net.tcp服務。通過WCF分佈式事務超時問題net.tcp綁定
在服務方面,我有以下的綁定配置:
<binding name="OrgSyncService_NetTcpBinding" portSharingEnabled="true"
transactionFlow="true" maxReceivedMessageSize="1048576000"
openTimeout="00:01:00" receiveTimeout="00:15:00" sendTimeout="00:15:00">
<security mode="Transport">
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign"/>
</security>
<readerQuotas maxStringContentLength="1073741824" />
<reliableSession enabled="true" inactivityTimeout="00:15:00" />
</binding>
正如你所看到的,所有相關的超時是15分鐘。在客戶端,綁定配置如下:
<binding name="NetTcpBinding_OrgSyncService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:15:00" sendTimeout="00:15:00"
transactionFlow="true" transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxConnections="10"
maxReceivedMessageSize="1048576000">
<readerQuotas maxDepth="32" maxStringContentLength="1073741824"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:15:00" enabled="true" />
<security mode="Transport">
<transport clientCredentialType="Windows"
protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>
同樣,我知道的所有超時設置爲15分鐘。最後,該代碼開始交易:
var options = new TransactionOptions
{
IsolationLevel = IsolationLevel.ReadCommitted,
Timeout = TimeSpan.FromMinutes(15)
};
using (var ts = new TransactionScope(TransactionScopeOption.Required, options))
{
// Do transactional work.
// Call web service.
service.HandleSourceChanges(listOfChanges);
ts.Complete();
}
Web服務方法本身具有以下特徵:
[OperationBehavior(TransactionScopeRequired = true, TransactionAutoComplete = true)]
public void HandleSourceChanges(IEnumerable<OrgSyncSourceChange> sourceChanges)
{ /* Handle changes and store them in the database. */ }
但是,正如我所說的,正好在開始交易,超時10分鐘後, 。我不確定這是交易本身超時。這可能是導致交易超時的超時組件。
我錯過了什麼?有沒有我不知道的IIS設置?一個MSDTC設置?
奇怪的是,這覆蓋了你的配置中的值。一個要記住 – 2010-12-06 13:38:51