获取服务超时异常

时间:2012-09-28 10:49:43

标签: java .net web-services exception

重大变更

实测值:

<binding name="EntityExtractionPortBinding" closeTimeout="00:01:00"
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>
在app.config中

并在那里查看所有超时,即使这样它也会抛出相同的异常。 CHANGE:

<binding name="EntityExtractionPortBinding" closeTimeout="00:60:00"
      openTimeout="00:60:00" receiveTimeout="00:60:00" sendTimeout="00:60:00"
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
      maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
      useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
      <security mode="None">
        <transport clientCredentialType="None" proxyCredentialType="None"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
    </binding>

我在调用webservice时收到TimeOut异常。 web服务部署在java中,我的客户端是c#winform。 Web服务部署在TOMCAT服务器上它在客户端提供以下异常:

  

请求频道在等待回复后超时   00:00:56.9230000。增加传递给调用的超时值   请求或增加Binding上的SendTimeout值。时间   分配给这个操作可能是一个更长的一部分   超时。

客户端的例外:

  

发现了System.TimeoutException     消息=请求通道在00:01:00之后等待回复时超时。增加传递给Request的调用的超时值或增加Binding上的SendTimeout值。分配给此操作的时间可能是较长超时的一部分。     来源= mscorlib程序     堆栈跟踪:       服务器堆栈跟踪:          在System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时)          在System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时)          在System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object [] ins,Object [] outs,TimeSpan timeout)          在System.ServiceModel.Channels.ServiceChannel.Call(String action,Boolean oneway,ProxyOperationRuntime operation,Object [] ins,Object [] outs)          在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)          在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)       在[0]处重新抛出异常:          在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)          在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData,Int32 type)          at abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtraction.extractNERTokensFromFile(extractNERTokensFromFileRequest request)          在C:\ Users \ htiwari \ Documents \ ae-establishin \ ae \ CommonUtilities \ abc \ ae-Re \中的abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtractionClient.abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtraction.extractNERTokensFromFile(extractNERTokensFromFileRequest请求) SnippetExtraction \ Service References \ DictionaryLookUp \ Reference.cs:第1069行          在C:\ Users \ htiwari \ Documents \ ae-establishin \ ae \ CommonUtilities \ abc \ ae-Re \ SnippetExtraction \ Service References \ DictionaryLookUp \ Reference.cs中的abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtractionClient.extractNERTokensFromFile(String fileName) :第1075行          在C:\ Users \ htiwari \ Documents \ ae-establishin \ ae \ CommonUtilities \ abc \ ae-Re \ SnippetExtraction \ TokenizeAndMap2.cs中的abc.ae.SnippetExtraction.TokenizeAndMap2.ConfigureSnippetList(Snippet snippet):第42行     InnerException:System.TimeoutException          Message =对'http://172.22.4.224:8084/EntityExtraction/EntityExtraction'的HTTP请求超出了分配的超时00:01:00。分配给此操作的时间可能是较长超时的一部分。          来源= System.ServiceModel          堆栈跟踪:               在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException,HttpWebRequest request,HttpAbortReason abortReason)               at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)               在System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时)          InnerException:System.Net.WebException               消息=操作已超时               来源=系统               堆栈跟踪:                    在System.Net.HttpWebRequest.GetResponse()                    at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)               InnerException:

通过WSDL访问Webservice。我的app.config中有以下代码

客户端的app.config代码

<endpoint address="http://localhost:8084/EntityExtraction/EntityExtraction"
    binding="basicHttpBinding" bindingConfiguration="EntityExtractionPortBinding"
    contract="DictionaryLookUp.EntityExtraction" name="EntityExtractionPort" />

3 个答案:

答案 0 :(得分:0)

如果我了解你的超时设置少于60秒或者你的web服务只需要更多的时间来处理查询并给出响应。增加请求的时间或优化Web服务。

使用SoapUI进行测试,webservice响应需要多长时间。

答案 1 :(得分:0)

无法在app.config文件中输入任何值。但是,当我通过硬编码增加超时值时,它确实有效:

DictionaryLookUp.EntityExtractionClient nlp = new 
                             DictionaryLookUp.EntityExtractionClient();
nlp.InnerChannel.OperationTimeout = new TimeSpan(0, 50, 0);

答案 2 :(得分:0)

在将超时设置为值timeout =“00:60:00”时,我遇到了类似的经历。它就像系统将其解释为0秒。如果需要,将值设置为“00:59:00”或“01:00:00”