WCF LIST transmits big data, the remote server returns an unexpected response 400

Source: Internet
Author: User

The WCF Transport list big Data volume appears that the remote server returned an unexpected response 400 error prompt.

This problem, a variety of search, have not solved the problem, and some are more complex, their own pondering a bit, in fact, it is not difficult, good, see the following program.
Solution:
In the Web. config (host) side <system.serviceModel> section, add the Services section as follows:
<services>
<service behaviorconfiguration= "App.dcgkbehavior" name= "Erpassistwcf.dcgkservice" >
<endpoint address= "" binding= "Wshttpbinding" bindingconfiguration= "Bindconfig"

contract= "Erpassistwcf.idcgkservice"/>
<endpoint address= "Mex" binding= "mexHttpBinding" contract= "IMetadataExchange"/>
</service>
</services>

The name in the service is set to the WCF library name +wcf SVC file name.
Endpoint contract is set to the WCF library name +WCF contract file name.

Note Here are a few key items: behaviorconfiguration,bindingconfiguration,binding

Take a look at the first key item and see the configuration of the <behaviors> section below:
See <behaviors> has two configurations, one name= "", This behavior section is mandatory and cannot be deleted.
Look at the second behavior section, name App.dcgkbehavior, this name can be taken casually, but, however, the important thing

Three times, this name must be the same as the behaviorconfiguration name in the service section mentioned above.

 
<behaviors>
      <servicebehaviors>
         <behavior name= "";
          < Servicemetadata httpgetenabled= "true"/>
          < Servicedebug includeexceptiondetailinfaults= "true"/>
           <servicetimeouts transactiontimeout= "00:50:00"/>
           <datacontractserializer maxitemsinobjectgraph= "2147483647"/>
           <servicethrottling maxconcurrentcalls= "2147483647"

maxconcurrentinstances= "2147483647" maxconcurrentsessions= "2147483647"/>
         </behavior>
        <behavior name= " App.dcgkbehavior,
          <servicemetadata Httpgetenabled= "true"/>
          <servicedebug Includeexceptiondetailinfaults= "true"/>
          < Servicetimeouts transactiontimeout= "00:50:00"/>
          <datacontractserializer maxitemsinobjectgraph= "2147483647"/>
           <servicethrottling maxconcurrentcalls= "2147483647"

Maxconcurrentinstances= "2147483647" maxconcurrentsessions= "2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
Here is the second keyword bindingconfiguration, see the following <bindings> section:
By the way, the second keyword bindingconfiguration after the name of this inoculation binding section name, that is:
Bindconfig

<bindings>
<wsHttpBinding>
<binding name= "Bindconfig" closetimeout= "00:10:00"
opentimeout= "00:10:00" receivetimeout= "00:10:00" sendtimeout= "00:10:00"
Bypassproxyonlocal= "false" transactionflow= "false"

Hostnamecomparisonmode= "StrongWildcard"
Maxbufferpoolsize= "2147483647" maxreceivedmessagesize= "2147483647"
messageencoding= "Text" textencoding= "Utf-8" usedefaultwebproxy= "true"
Allowcookies= "false" >
<readerquotas maxdepth= "2147483647" maxstringcontentlength= "

Maxarraylength= "2147483647"
Maxbytesperread= "2147483647" maxnametablecharcount= "2147483647"/>
<reliablesession ordered= "true" inactivitytimeout= "00:10:00"
Enabled= "false"/>

<security mode= "None" >
<transport clientcredentialtype= "None" proxycredentialtype= "None"
Realm= ""/>
<message clientcredentialtype= "None" negotiateservicecredential= "true"
Algorithmsuite= "Default" establishsecuritycontext= "true"/>
</security>

</binding>
</wsHttpBinding>

</bindings>
Here is the third keyword binding, see above in the <bindings> section, I use the <wshttpbinding>

, the binding keyword equals "Wshttpbinding".

The above is the setting in Webconfig.
After Setup is complete, regenerate WCF. Then on the client side, the referenced WCF service is deleted and re-referenced. VS will automatically update

App. CONFIG. After the configuration is generated, the allowed size of the bytes is still the default, which can be referred to the server configuration, and the value will be changed to maximum

2147483647.
The following configuration is generated for app. config:

<wsHttpBinding>
<binding name= "Wshttpbinding_idcgkservice" closetimeout= "00:01:00"
opentimeout= "00:01:00" receivetimeout= "00:10:00"

sendtimeout= "00:10:00"
Bypassproxyonlocal= "false" transactionflow= "false"

Hostnamecomparisonmode= "StrongWildcard"
                     maxbufferpoolsize= "2147483647" maxreceivedmessagesize= " 2147483647 "
                     messageencoding= "Text" textencoding= "Utf-8" usedefaultwebproxy= "true"
                     Allowcookies= "false";
                     <readerquotas maxdepth= "+" maxstringcontentlength= "2147483647"

Maxarraylength= "2147483647"
                         maxbytesperread= "2147483647" Maxnametablecharcount= "2147483647"/>
                     <reliablesession ordered= "true" inactivitytimeout= "00:10:00"
                         enabled= "false"/>
                     <security mode= "None";
                          <transport clientcredentialtype= "Windows"

Proxycredentialtype= "None"
Realm= ""/>
<message clientcredentialtype= "Windows"

Negotiateservicecredential= "true"/>
</security>
</binding>
</wsHttpBinding>

WCF LIST transmits big data, the remote server returns an unexpected response 400

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.