【问题标题】:Consuming SAP web-service from .NET throws exception ServiceModel.FaultException从 .NET 使用 SAP Web 服务会引发异常 ServiceModel.FaultException
【发布时间】:2017-03-03 18:27:19
【问题描述】:

我引用了 WSDL 文件并向 SAP Web 服务发出请求并得到以下异常

System.ServiceModel.FaultException:服务器错误服务器堆栈跟踪:在 System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 在 [0] 处重新抛出异常:

在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 类型)

我可以通过 SOAPUI 中的 WSDL 使用 Web 服务。

我还设置了以下绑定属性。

 var binding = new BasicHttpsBinding
        {
            SendTimeout = TimeSpan.MaxValue,
            MaxReceivedMessageSize = Int32.MaxValue,
            CloseTimeout = TimeSpan.MaxValue,
            OpenTimeout = TimeSpan.MaxValue,
            ReceiveTimeout = TimeSpan.MaxValue,
            MaxBufferPoolSize = Int64.MaxValue
            
        };

我跟踪来自 fiddler 的 Visual Studio 请求,并且可以从 SoapUI 执行相同的请求,但是在尝试通过 Visual Studio 消费时,发生了异常。

【问题讨论】:

    标签: c# .net web-services wcf sap


    【解决方案1】:

    其实我是从零开始,解决了问题。

    响应超过 8mb,请求耗时超过 100 秒。

    我在配置文件中做了如下修改,问题就解决了。

        <binding receiveTimeout="00:20:00" sendTimeout="00:20:00"
    openTimeout="00:05:00"  closeTimeout="00:05:00"
    maxReceivedMessageSize="20000000"  maxBufferSize="20000000" maxBufferPoolSize="20000000" >
    <readerQuotas maxDepth="20000000"
                                maxStringContentLength="20000000"
                                maxArrayLength="20000000"
                                maxBytesPerRead="20000000"
                                maxNameTableCharCount="20000000" />
       ....
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多