Web.config上的配置:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyDataService_Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_MyDataService"
receiveTimeout="00:10:00"
sendTimeout="00:10:00"
openTimeout="00:10:00"
closeTimeout="00:10:00"
maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" >
<readerQuotas
maxArrayLength="2147483647"
maxBytesPerRead="2147483647"
maxDepth="2147483647"
maxNameTableCharCount="2147483647"
maxStringContentLength="2147483647" />
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="MyWebSer.MyDataService" behaviorConfiguration="MyDataService_Behavior">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_MyDataService"
contract="MyWebSer.MyDataService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
ServiceReferences.ClientConfig的配置:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_MyDataService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:1816/MyDataService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_MyDataService" contract="MySerRef.MyDataService"
name="BasicHttpBinding_MyDataService" />
</client>
</system.serviceModel>
测试时查询了50000条记录,每条记录有不少于40个字段。