繁体   English   中英

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

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

我有两个应用程序一起工作。 第一个是与第二个服务进行通信的客户端。 两者都是用C#/。NET编写的。

客户端具有一个网页,该网页基于先前提交的数据(也在客户端内)提交表单。

有问题的提交由服务处理。

在大多数情况下,提交都可以,但是在极少数情况下,可以处理许多(200+)个元素。 这是超时问题的出处。

在尝试处理提交的地方设置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:

因此,我在客户端和服务中都使用了Web.config文件,并使用以下设置binding标签:

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

奇怪的是,如果我将其设置为大于1分钟的任何时间(特别是在客户端中),则无法识别自定义值。 如果我将值设置为少于1分钟,则可以识别自定义值。

我也玩过maxReceivedMessageSizemaxBufferSizemaxBufferPoolSize但无济于事。

我真的不认为这与两个应用程序中的逻辑都有关,好像元素计数为〜<100并不存在问题。 但是我们必须能够处理200+个元素。

在两个应用程序中都设置断点有所帮助,但实际上并没有帮助我。

任何见解对此表示赞赏。

将以下设置用于服务器和客户端。 在我们的服务中,我们使用它来传输大量数据似乎对我们有用。

 <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