c# - sending large dataset to WCF service gives protocol exception -
i have wpf application sending dataset
25 datatable
. not able fix the remote server returned unexpected response: (400) bad request
synchronous , asynchronous both. below app.config:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_icommunication" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="01:00:00" sendtimeout="01:00:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="2147483647" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true"> <readerquotas maxdepth="2147483647" maxstringcontentlength="2147483647" maxarraylength="2147483647" maxbytesperread="2147483647" maxnametablecharcount="2147483647" /> <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding> </bindings> <client> <endpoint address="http://localhost:49486/communication.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_icommunication" contract="communicationreference.icommunication" name="basichttpbinding_icommunication" /> </client> </system.servicemodel> </configuration>
and service's web.config:
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="true" targetframework="4.0" /> <httpruntime maxrequestlength="2147483647" executiontimeout="10000"/> </system.web> <connectionstrings> <add name="conname" connectionstring="data source=*******;initial catalog=****; user id=**; password=*****"/> </connectionstrings> <system.servicemodel> <behaviors> <servicebehaviors> <behavior> <!-- avoid disclosing metadata information, set value below false , remove metadata endpoint above before deployment --> <servicemetadata httpgetenabled="true"/> <!-- receive exception details in faults debugging purposes, set value below true. set false before deployment avoid disclosing exception information --> <servicedebug includeexceptiondetailinfaults="false"/> <servicethrottling maxconcurrentcalls="100" maxconcurrentsessions="1000" maxconcurrentinstances="1600" /> </behavior> </servicebehaviors> </behaviors> <servicehostingenvironment multiplesitebindingsenabled="true" /> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true"/> </system.webserver> </configuration>
p.s.: tested passing blank dataset
, working. dataset
datatable
not working.
i have included entire service model reference, please set contract have set largedataservice appropriate interface
<system.servicemodel> <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true"/> <bindings> <basichttpbinding> <binding name="largedatabinding" maxreceivedmessagesize="4194304"> <readerquotas maxarraylength="2147483647" maxbytesperread="2147483647" maxdepth="2147483647" maxnametablecharcount="2147483647" maxstringcontentlength="2147483647"/> </binding> </basichttpbinding> </bindings> <services> <service behaviorconfiguration="webbehavior" name="serviceendpoints"> <endpoint address="" binding="basichttpbinding" bindingconfiguration="largedatabinding" behaviorconfiguration="custombehavior" contract="largedataservice"/> </service> </services> <behaviors> <servicebehaviors> <behavior name="webbehavior"> <servicemetadata httpgetenabled="true" httpsgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> <datacontractserializer maxitemsinobjectgraph="2147483646" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="custombehavior"> <webhttp automaticformatselectionenabled="false" helpenabled="true"/> <datacontractserializer maxitemsinobjectgraph="2147483646" /> </behavior> </endpointbehaviors> </behaviors> </system.servicemodel>
Comments
Post a Comment