Java 获取服务超时异常

Java 获取服务超时异常,java,.net,web-services,exception,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

重大变化

发现:

<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中,并在那里更改所有超时,即使它也会引发相同的异常。更改:

<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>

我在调用Web服务时遇到超时异常。Web服务是用java部署的,我的客户机是c#winform。webservice部署在TOMCAT服务器上,它在客户端出现以下异常:

请求通道在之后等待答复时超时 00:00:56.9230000. 增加传递给调用的超时值 请求或增加绑定上的SendTimeout值。时间 分配给该操作的可能是更长时间的一部分 超时

客户端异常:

已捕获System.TimeoutException Message=请求通道在00:01:00之后等待答复时超时。增加传递给请求调用的超时值或增加绑定上的SendTimeout值。分配给此操作的时间可能是较长超时的一部分。 Source=mscorlib 堆栈跟踪: 服务器堆栈跟踪: 位于System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时) 位于System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息消息,TimeSpan超时) 在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出、时间跨度超时) 在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作、布尔单向、ProxyOperationRuntime操作、对象[]输入、对象[]输出) 位于System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage方法调用,ProxyOperationRuntime操作) 位于System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息) 在[0]处重试异常: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg) at System.Runtime.Remoting.proxy.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型) 位于abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtraction.ExtracterTokensFromFile(ExtracterTokensFromFileRequest请求) 在C:\Users\htiwari\Documents\ae-establishin\ae\CommonUtilities\abc\ae-Re\SnippetExtraction\Service References\DictionaryLookUp\EntityExtraction.ExtracterTokensFromFile(ExtracterTokensFromFileRequest请求)中的abc.ae.SnippeterExtraction 在abc.ae.SnippetExtraction.DictionaryLookUp.EntityExtractionClient.ExtracterTokensFromFile(字符串文件名)中的C:\Users\htiwari\Documents\ae-establishin\ae\CommonUtilities\abc\ae-Re\SnippetExtraction\Service References\DictionaryLookUp\Reference.cs:第1075行 在C:\Users\htiwari\Documents\ae-estriftin\ae\CommonUtilities\abc\ae-Re\SnippetExtraction\TokenizeAndMap2.cs中的abc.ae.SnippetExtraction.TokenizeAndMap2.ConfigureSnippetList(Snippet Snippet Snippet)中:第42行 InnerException:System.TimeoutException Message=发送到的HTTP请求'http://172.22.4.224:8084/EntityExtraction/EntityExtraction'已超过分配的00:01:00超时。分配给此操作的时间可能是较长超时的一部分。 Source=System.ServiceModel 堆栈跟踪: 位于System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException WebException、HttpWebRequest请求、HttpBortreason abortReason) 位于System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时) 位于System.ServiceModel.Channels.RequestChannel.Request(消息消息,TimeSpan超时) InnerException:System.Net.WebException Message=操作已超时 来源=系统 堆栈跟踪: 在System.Net.HttpWebRequest.GetResponse()中 位于System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超时) 内部异常:

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

客户端app.config上的代码

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

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


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

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

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

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

您能详细解释一下吗?哇,您是不是想在提问无法回答的问题方面赢得比赛。。。更多的信息真的会有帮助。首先,你能通过soapUI访问WS吗?Stacktrace是什么?你尝试过解决这个问题吗?您的问题缺少一些重要的细节。此异常仅在某些情况下才会引发。就像当我给出一个大的输入时,抛出这个异常。你能告诉我在这个问题中应该提到哪些其他细节吗?你应该用soapui测试相同的查询,看看需要多长时间来响应。您可能需要改进Web服务或增加超时时间。是的,在上面找不到太多。老实说,我对这个东西知之甚少,在谷歌的帮助下部署了它。现在在哪里增加超时->java端或客户端。即使在这一点上我也感到困惑。你的客户在等待服务的答复。它等待60秒