C# WCF异常-处理请求时发生错误。

C# WCF异常-处理请求时发生错误。,c#,web-services,wcf,wcf-data-services,wcf-binding,C#,Web Services,Wcf,Wcf Data Services,Wcf Binding,我正在尝试通过web服务访问数据。我的webservice调用工作得非常好,但有时它会在处理请求时抛出错误有关异常的其他信息,请参见故障详细信息 以下是我对错误的跟踪: at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Cal

我正在尝试通过web服务访问数据。我的webservice调用工作得非常好,但有时它会在处理请求时抛出错误<代码>有关异常的其他信息,请参见故障详细信息

以下是我对错误的跟踪:

  at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
  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)
我已经尝试在我的绑定中增加readerquota。下面是我的绑定的外观

<bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IWS" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647">
          <readerQuotas
           maxDepth="2147483647"
           maxStringContentLength="2147483647"
           maxArrayLength="2147483647"
           maxBytesPerRead="2147483647"
           maxNameTableCharCount="2147483647" />
          <security mode="TransportWithMessageCredential" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://xxxx.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IWS"
        contract="ABC.IWS" name="BasicHttpBinding_IWS" />
    </client>


这里是否缺少一些配置?

我也有同样的问题,解决方案是设置所调用服务的所有参数。使用SOAPUI应用程序,您可能一次也不会注意到它。但和往常一样,菲德勒说的是实话。例如,一开始您认为“重要的_参数””足以设置调用服务。您认为web服务认为(/set本身)“EndTo”参数为0。。。错了!你应该故意设置它,否则你会得到这篇文章中提到的错误

...
<important_parameters>
   ....
</important_parameters>
<Paging>
   <EndTo>0</EndTo>
</Paging>
...
。。。
....
0
...

我也遇到了同样的问题,解决方案是设置所调用服务的所有参数。使用SOAPUI应用程序,您可能一次也不会注意到它。但和往常一样,菲德勒说的是实话。例如,一开始您认为“重要的_参数””足以设置调用服务。您认为web服务认为(/set本身)“EndTo”参数为0。。。错了!你应该故意设置它,否则你会得到这篇文章中提到的错误

...
<important_parameters>
   ....
</important_parameters>
<Paging>
   <EndTo>0</EndTo>
</Paging>
...
。。。
....
0
...

对我来说,故障排除的第一步是获取有关错误的更多信息。由于任务响应的工作方式,可能存在许多内部异常。因此,更改处理代码以记录内部异常

var responseTask = client.someRemoteCall(request);

responseTask.ContinueWith(t =>
{
    switch (t.Status)
    {
        case TaskStatus.Faulted:
            foreach (var exception in t.Exception.Flatten().InnerExceptions)
            {
                log.Error(exception.Message);

                if (exception.InnerException != null)
                {
                    log.Error(exception.InnerException.Message);
                }
            }
            break;
        case TaskStatus.RanToCompletion:
            {your success code}
        default:
            {some deafult error is thrown}
    }
});

对我来说,故障排除的第一步是获取有关错误的更多信息。由于任务响应的工作方式,可能存在许多内部异常。因此,更改处理代码以记录内部异常

var responseTask = client.someRemoteCall(request);

responseTask.ContinueWith(t =>
{
    switch (t.Status)
    {
        case TaskStatus.Faulted:
            foreach (var exception in t.Exception.Flatten().InnerExceptions)
            {
                log.Error(exception.Message);

                if (exception.InnerException != null)
                {
                    log.Error(exception.InnerException.Message);
                }
            }
            break;
        case TaskStatus.RanToCompletion:
            {your success code}
        default:
            {some deafult error is thrown}
    }
});

我也有同样的问题。我怀疑对响应进行反序列化时会出现一些问题,但在这个问题上,我没有解决方案。我遇到了完全相同的问题。我怀疑对响应进行反序列化时存在一些问题,但在这方面我没有解决方案。