WCF の net.tcp バインディングを介して分散トランザクションを実行すると、奇妙なタイムアウトの問題が発生します。トランザクションは常に正確に 10 分後にタイムアウトします。私が知っているすべてのタイムアウトをそれよりも高い値 (15 分) に設定したと思いますが、おそらく何かを見落としています。IIS7.5 でホストされている 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 設定?