简体   繁体   English

C#服务HTTP请求忽略自定义超时值

[英]C# Service HTTP Request ignoring custom timeout values

I have two applications working together. 我有两个应用程序一起工作。 The first is the client that communicates with the second, the service. 第一个是与第二个服务进行通信的客户端。 Both are written in C#/.NET. 两者都是用C#/。NET编写的。

The client has a web page which submits a form based on previously submitted data (also within the client). 客户端具有一个网页,该网页基于先前提交的数据(也在客户端内)提交表单。

The submission in question is handled by the service. 有问题的提交由服务处理。

For the most part, the submissions are fine but in somewhat rare scenarios there can be many (200+) elements to handle on the submission. 在大多数情况下,提交都可以,但是在极少数情况下,可以处理许多(200+)个元素。 This is where the timeout issue comes in. 这是超时问题的出处。

Setting up a try/catch block where the submission is handled results in the following: 在尝试处理提交的地方设置try / catch块会导致以下结果:

catching error: System.ServiceModel.FaultException 1[System.ServiceModel.ExceptionDetail]: The HTTP request to 'WSDL SERVICE HERE' has exceeded the allotted timeout of 00:01:00. The time allotted to this operation may have been a portion of a longer timeout. (Fault Detail is equal to An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:

So I've toyed with the Web.config files in both the client and the service, setting binding tags with the following: 因此,我在客户端和服务中都使用了Web.config文件,并使用以下设置binding标签:

openTimeout="00:10:00" closeTimeout="00:10:00" sendTimeout="00:10:00" receiveTimeout="00:10:00"

What's odd is that if I set it to anything greater than 1 minute (notably in the client), the custom values are not recognized. 奇怪的是,如果我将其设置为大于1分钟的任何时间(特别是在客户端中),则无法识别自定义值。 If I set the values to less than 1 minute, the custom values are recognized. 如果我将值设置为少于1分钟,则可以识别自定义值。

I've also played around with maxReceivedMessageSize , maxBufferSize and maxBufferPoolSize but to no avail. 我也玩过maxReceivedMessageSizemaxBufferSizemaxBufferPoolSize但无济于事。

I really do not think it is something related to the logic in either application as if the element count is ~<100 there is not an issue. 我真的不认为这与两个应用程序中的逻辑都有关,好像元素计数为〜<100并不存在问题。 But we do have to be able to handle element counts of 200+. 但是我们必须能够处理200+个元素。

Setting breakpoints in both applications has helped a bit but really hasn't gotten me anywhere. 在两个应用程序中都设置断点有所帮助,但实际上并没有帮助我。

Any insight on this is appreciated. 任何见解对此表示赞赏。

Use the below settings for both server and client. 将以下设置用于服务器和客户端。 In our service we use this to traffic huge volume of data seems to work for us. 在我们的服务中,我们使用它来传输大量数据似乎对我们有用。

 <system.serviceModel> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> <bindings> <basicHttpBinding> <binding name="basicHttp" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" transferMode="Streamed"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/> </binding> </basicHttpBinding> </bindings> <services> <service behaviorConfiguration="ServiceBehavior" name="MyService"> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttp" name="MyService" bindingNamespace="CustomNameSpace" contract="IService"> <identity> <dns value="localhost" /> </identity> </endpoint> </service> </services> <behaviors> <endpointBehaviors> <behavior name="web"> <webHttp /> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior name="ServiceBehavior"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="true" /> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM