我們有一個應用程序將一個對象(本例中爲「printJob」)發送給服務。根據我們的交易量,這個過程可能需要一段時間。一旦服務完成了它的工作,它就會嚮應用程序返回一個「PrintJobID」。WCF超時問題
PrintGatewayClient printClient = new PrintGatewayClient();
PrintService.ServiceJob printJob = new PrintService.ServiceJob();
printJob.ServicePrintItems = checkList.ToArray();
try
{
currentBatch.PrintJobID = printClient.SubmitPrintJob(printJob);
PaymentBatchesGateway.Update(currentBatch);
}
catch (System.Exception ex)
{
throw ex;
}
printClient.Close();
的appliation等待,等待printClient來完成它的工作並領取「PrintJobID」的整數然後更新一個表,該ID。然而,當大批量的跑了,我們得到以下錯誤:
The request channel timed out while waiting for a reply after 00:04:59.9062464. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.
我已經看過我們的web.config文件在NetTcpBinding的:
<netTcpBinding>
<binding name="NetTcpBinding_IPrintGateway" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="02:00:00" sendTimeout="02:00:00"
transactionFlow="false" transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard" listenBacklog="10"
maxBufferPoolSize="524288" maxBufferSize="50000000" maxConnections="10"
maxReceivedMessageSize="50000000">
<readerQuotas maxDepth="5000" maxStringContentLength="150000"
maxArrayLength="16384" maxBytesPerRead="50000000"
maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="None" protectionLevel="None" />
<message clientCredentialType="None" />
</security>
</binding>
<netTcpBinding>
<client>
<endpoint address="http://server/printgateway/PrintGateway.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IPrintGateway"
contract="PrintService.IPrintGateway"
name="BasicHttpBinding_IPrintGateway" />
</client>
我無法找到一個超時的00 :05:00在代碼中的任何地方。任何人都可以請解釋並告訴我如何延長這個時間。我可以在代碼中,在web.config中,在服務器上執行此操作嗎?
謝謝!
我不是特別WCF知識淵博,我不知道哪裏有5分鐘的超時是從哪裏來的。然而,對於測試,你有沒有嘗試增加你的closeTimeout,openTimeout,receiveTimeout,和值的SendTimeout的東西要高得多,如果expception仍然出現看?我也相信你可以創建一個合適的綁定對象,設置binding.SendTimeout = TimeSpan.FromMinutes(60); (以及其他超時值),並在創建服務客戶端時使用該對象。 –
Dan
2012-01-12 17:41:24