简体   繁体   English

无法解决WCF超时错误

[英]Cannot resolve WCF timeout error

I am consistently getting the following error from my QA server: 我始终从我的质量检查服务器中收到以下错误:

Message: { strMessage = Class: ShopProcessServiceClient Method: Main Error: An error occurred while receiving the HTTP response to http://xxx.xxx.x.xxx/RyderShopProcessService/ShopProcessService.svc . 消息:{strMessage =类:ShopProcessServiceClient方法:主要错误:收到对http://xxx.xxx.x.xxx/RyderShopProcessService/ShopProcessService.svc的HTTP响应时发生错误。 This could be due to the service endpoint binding not using the HTTP protocol. 这可能是由于服务端点绑定未使用HTTP协议。 This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). 这也可能是由于服务器终止了HTTP请求上下文(可能是由于服务关闭了)。 See server logs for more details. 有关更多详细信息,请参见服务器日志。 InnerException: System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. InnerException:System.Net.WebException:基础连接已关闭:接收时发生意外错误。 ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.IO.IOException:无法从传输连接中读取数据:现有连接被远程主机强行关闭。 ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) Source: mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory ---> System.Net.Sockets.SocketException:远程主机在System.Net.Sockets.Socket.Receive(Byte []缓冲区,Int32偏移量,Int32大小,SocketFlags socketFlags)处强制关闭了现有连接。 Net.Sockets.NetworkStream.Read(Byte []缓冲区,Int32偏移量,Int32大小)---内部异常堆栈跟踪的结尾---在System.Net.Sockets.NetworkStream.Read(Byte []缓冲区,Int32偏移量, System.Net.PooledStream.Read(字节[]缓冲区的Int32大小),System.Net.Connection.SyncRead(HttpWebRequest请求,布尔userRetrievedStream,布尔probeRead)的int32偏移量,Int32大小)---内部异常堆栈跟踪的结尾---在System.Net.HttpWebRequest.GetResponse()在System.ServiceModel.Channels.HttpChannelFactory 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) Source: mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) Source: mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Ryder.ShopProcessService.Outbound.ShopProcessService.IShopProcessService.GetCusts() a 1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) Source: mscorlib StackTrace: Server stack trace: at System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason) at System.ServiceModel.Channels.HttpChannelFactory abortReason)1. System.ServiceModel.Channels.RequestChannel.Request(Message消息,TimeSpan超时)的System.ServiceModel.Channels.RequestChannel.Request(MessageS的TimeSpan超时)的System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message的)消息,System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布尔型单向,ProxyOperationRuntime操作,Object [] ins,Object [] out,TimeSpan超时),位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage) System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)上的methodCall,ProxyOperationRuntime操作)在[0]处引发了异常:在System.Runtime处,System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)处引发了异常。在Ryder.ShopProcessService.Outbound.ShopProcessService.IShopProcessService.GetCusts()处的Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型) t Ryder.ShopProcessService.Outbound.ShopProcessService.ShopProcessServiceClient.GetCusts() in c:\\Development\\SMO_VS_2013\\HHOutboundClient\\SOASolutionA\\Ryder.ShopProcessService.Outbound\\Service References\\ShopProcessService\\Reference.cs:line 7698 at Ryder.ShopProcessService.Outbound.ShopProcessServiceClient.Main(String[] args) in c:\\Development\\SMO_VS_2013\\HHOutboundClient\\SOASolutionA\\Ryder.ShopProcessService.Outbound\\ShopProcessServiceClient.cs:line 399, strProject = Ryder.ShopProcessService.Outbound, strRemedyTktResponse = INC000000091594 } Extended Properties: t c:\\ Development \\ SMO_VS_2013 \\ HHOutboundClient \\ SOASolutionA \\ Ryder.ShopProcessService.Outbound \\ Service References \\ ShopProcessService \\ Reference.cs:Ryder.ShopProcessService.Outbound中的Ryder.ShopProcessService.Outbound.ShopProcessService.ShopProcessServiceClient.GetCusts()。 c:\\ Development \\ SMO_VS_2013 \\ HHOutboundClient \\ SOASolutionA \\ Ryder.ShopProcessService.Outbound \\ ShopProcessServiceClient.cs:line 399中的ShopProcessServiceClient.Main(String [] args):行399,strProject = Ryder.ShopProcessService.Outbound,strRemedyTktResponse = INC000000091594}扩展属性:

While looking up the associated errors in the above text, they all point to either increasing the send/receive timeout and or maxing out the data values being sent (like maxItemsInObjectGraph="2147483647") . 在上面的文本中查找相关的错误时,它们都指向增加发送/接收超时或使发送的数据值最大化(例如maxItemsInObjectGraph =“ 2147483647”) I have done both and still cannot get around this error. 我都做了,仍然无法解决此错误。

The thing is that when I run the same application with the same settings from within Visual Studio, no error occurs . 问题是,当我从Visual Studio 运行使用相同的设置相同的应用程序, 不会发生错误 It only occurs when running on our QA server . 它仅在我们的质量检查服务器上运行时发生

It always crashes when processing the same collection around 170,000 records or so. 处理大约170,000条左右的记录时,它总是崩溃。 The next biggest one is around 50,000 records. 第二大记录是大约50,000条记录。 It did make it past it once, but subsequent tries have failed. 它确实使它过去了一次,但随后的尝试都失败了。

The other thing in the error that interests me is the following: System.IO.IOException: Unable to read data from the transport connection 错误中令我感兴趣的另一件事是: System.IO.IOException:无法从传输连接读取数据

Also worth noting is the fact that I had a command timeout (for the sql to execute, although after debugging, it takes only a couple of seconds) of 5 mins and when the 5 mins were up, the error occurred. 同样值得注意的是,我有一个5分钟的命令超时(为了执行sql,尽管在调试后只需要几秒钟),而当5分钟结束时,发生了错误。 When I took the command timeout out and left it at the default, it crashed at the default value time. 当我使命令超时并将其保留为默认值时,它在默认值时间崩溃了。 This possibly tells me it is having trouble reading the data in the database. 这可能告诉我在读取数据库中的数据时遇到麻烦。

If somebody can inform me what else I might be able to change to get around this error, I would greatly appreciate it. 如果有人可以告诉我还有什么我可以更改以解决此错误,我将不胜感激。

Below is the pertinent web.config file settings for my service : 以下是我的服务的相关web.config文件设置

<system.serviceModel>
    <client>
      <endpoint address="http://999.999.99.999/RyderCommonServices/ContentManagementService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ContentManagementService"
        contract="ContentManagementService.ContentManagementService"
        name="BasicHttpBinding_ContentManagementService" />
    </client>
    <services>
      <service name="Ryder.ShopProcessService.SOA.ShopProcessService" behaviorConfiguration="ServiceBehavior">
        <endpoint address="" binding="wsHttpBinding" contract="Ryder.ShopProcessService.SOA.IShopProcessService" bindingConfiguration="WsHttpBinding_IShopProcessService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <!--<add baseAddress="\\miavdeteoabweb\c$\inetpub\Dev\RyderShopProcessService" />-->
          </baseAddresses>
        </host>
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="WsHttpBinding_IShopProcessService" closeTimeout="00:10:00"
          openTimeout="00:10:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"
            maxBytesPerRead="2147483647" />
          <security mode="None" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <diagnostics wmiProviderEnabled="false" performanceCounters="All">
      <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="2147483647" maxMessagesToLog="500" />
    </diagnostics>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <!--<add scheme="http" binding="basicHttpBinding"/>-->
      <add scheme="https" binding="wsHttpBinding"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="2147483647" />
      </requestFiltering>
    </security>

This is the pertinent app.config settings for my client: 这是我的客户端的相关app.config设置:

<system.serviceModel>
    <bindings>
       <wsHttpBinding>
        <binding name="WsHttpBinding_IShopProcessService" closeTimeout="00:10:00"
          openTimeout="00:10:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>
        <binding name="WSHttpBinding_IShopProcessService">
          <security mode="None" />
        </binding>
      </wsHttpBinding>
    </bindings>
    <diagnostics wmiProviderEnabled="true">
      <messageLogging logMessagesAtTransportLevel="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logEntireMessage="true" maxSizeOfMessageToLog="2147483647" maxMessagesToLog="100" />
    </diagnostics>
    <client>
      <endpoint address="https://ryderfitest.velsol.com/RyderDataPortal/RyderService.svc"
        behaviorConfiguration="BasicHttpBinding_RyderService" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_RyderService" contract="HHOutBoundService.IRyderService"
        name="BasicHttpBinding_RyderService" />
      <endpoint address="http://999.999.9.999/RyderShopProcessService/ShopProcessService.svc" behaviorConfiguration="WsHttpBinding_IShopProcessService"
                binding="wsHttpBinding" bindingConfiguration="WsHttpBinding_IShopProcessService"
                contract="ShopProcessService.IShopProcessService" name="WsHttpBinding_IShopProcessService" />
    </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="WsHttpBinding_IShopProcessService">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
        <behavior name="webhttp">
          <webHttp/>
        </behavior>
        <behavior name="BasicHttpBinding_RyderService">
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>

I resolved the error by updating the send/receive/open/close timeouts. 我通过更新发送/接收/打开/关闭超时解决了该错误。 See below. 见下文。

<binding name="WsHttpBinding_IShopProcessService" closeTimeout="00:30:00"
          openTimeout="00:30:00" receiveTimeout="00:30:00" sendTimeout="00:30:00"
          maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None" />
        </binding>

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

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