参考:http://consultingblogs.emc.com/merrickchaffer/archive/2007/09/19/WCF-System.Net.WebException_3A00_-The-underlying-connection-was-closed_3A00_-The-connection-was-closed-unexpectedly.aspx
主要是在服务端和客户端增加序列化的配置:
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
服务端:
<service name="XXX" beaviorConfiguration="ProductMetadataServiceBehaviors">
<behaviors>
<serviceBehaviors>
<behavior name="ProductMetadataServiceBehaviors" >
<!-- Add the following element to your service behavior configuration. -->
<serviceMetadata httpGetEnabled="true" />
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</serviceBehaviors>
</behaviors>
客户端:
<client>
这个endpoint里
的 maxBufferSize="。。。" maxBufferPoolSize="。。。" maxReceivedMessageSize="。。。" 要设置的大一些。。。
<endpoint XXX....
behaviorConfiguration="SerializerBehaviour"/>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="SerializerBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>