webservice的TTP 响应时发生错误,可能是由于服务终结点绑定未使用 HTTP 协议造成的,解决办法
webservice调用异常,报错信息:接收对 http://www.bubuko.com/bubuko.asmx 的 HTTP 响应时发生错误。这可能是由于服务终结点绑定未使用 HTTP 协议造成的。这还可能是由于服务器中止了 HTTP 请求上下文(可能由于服务关闭)所致。
解决办法之一:
用SvcConfigEditor为客户端和服务端都加上一个behavior (服务端添加servicehehavior, 客户端添加endpointbehavior),然后为这两个服务各添加一个dataContractSerializer,把他的maxItemsInObjectGraph字段变成更大的数。我已经调试通过你的代码了。
这里是我这里服务端添加的log:
logMessagesAtTransportLevel="true" />
bindingConfiguration="NewBindingStationCnfg" contract="WcfServiceLibrary1.IContactManager" />
这里是我客户端的config:
logMessagesAtTransportLevel="true" />
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
enabled="false" />
realm="" />
algorithmSuite="Default" establishSecurityContext="true" />
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IContactManager1"
contract="ServiceReference2.IContactManager" name="WSHttpBinding_IContactManager1">