gpt4 book ai didi

c# - 使用 WCF Web 服务时获取 System.ServiceModel.ProtocolException

转载 作者:行者123 更新时间:2023-11-30 18:32:12 28 4
gpt4 key购买 nike

我正在使用我在 Web 服务端无法控制的 WCF Web 服务。

我已经提供了一个自动生成的 svc.cs 代理文件,我正在使用它。

实际上我是在请求 Web 服务从客户端下载一些大数据。

有时我得到

System.ServiceModel.ProtocolException

在我的客户端。

异常情况如下:

System.ServiceModel.ProtocolException: The number of bytes available is inconsistent with the HTTP Content-Length header. There may have been a network error or the client may be sending invalid requests.

Server stack trace: at System.ServiceModel.Channels.HttpInput.ReadBufferedMessage(Stream inputStream) at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException) at System.ServiceModel.Channels.HttpChannelFactory.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.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 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 IBulkDataSvc.GetEmployeesData(String BusinessPath, DateTime EffectiveDate, String TerminalName) at Empower.ServiceRequest.EmployeeDataXML(DateTime time, String terminal) at Empower.Empower.DownloadEmployeeList(String terminalName)

我在客户端的 web 服务绑定(bind)配置如下(仅显示绑定(bind)),

    <bindings>
<basicHttpBinding>
<binding name="BulkDataSvcSoap">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
<binding name="BulkDataSvcHttpsSoap">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
<netTcpBinding>
<binding name="BulkDataSvcTcp">
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>

我有点困惑它到底是从哪一端生成的,为什么会生成?

我已经用谷歌搜索了,但没有发现任何有用的东西。所以有人可以帮我解决这个难题吗.

最佳答案

你有没有机会读到这个calling non wcf service

此外,在某些情况下,如果您的请求带来的数据大于 web 服务端指定的数据,那么您一定会得到这个。

关于c# - 使用 WCF Web 服务时获取 System.ServiceModel.ProtocolException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18866699/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com