我们有一个应用程序将一个对象(本例中为“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