asp.net - WCF Error - unexpected response: (400) Bad Request -
i'm having trouble finding answer problem. similar posts lean seem fixed adjusting of maximum size settings in web.config file. however, none of suggestions have fixed issue.
to give little more background, i'm porting asmx web service, wcf web service hosted in windows azure. problem came during testing. if pass small number of transactions webservice in single call, tends work fine. error come though when transaction size gets around 50-60 (transactions). serialized xml, file size around 300k, it's nothing insanely large. tend lean towards size issue.
also, turning on wcf tracing, found following exception occuring:
system.servicemodel.protocolexception: maximum message size quota incoming messages (65536) has been exceeded. increase quota, use maxreceivedmessagesize property on appropriate binding element.
at system.servicemodel.channels.httpinput.throwhttpprotocolexception(string message, httpstatuscode statuscode, string statusdescription)
at system.servicemodel.channels.httpinput.throwmaxreceivedmessagesizeexceeded()
at system.servicemodel.channels.httpinput.readbufferedmessage(stream inputstream)
at system.servicemodel.channels.httpinput.parseincomingmessage(exception& requestexception)
at system.servicemodel.channels.httpchannellistener.httpcontextreceived(httprequestcontext context, action callback)
so exception, looks though 1 of settings if off in web.config, here looks like:
<system.servicemodel> <behaviors> <servicebehaviors> <behavior> <servicemetadata httpgetenabled="true"/> <servicedebug includeexceptiondetailinfaults="true"/> </behavior> <behavior name="metadataenabled"> <servicedebug includeexceptiondetailinfaults="true"/> <servicemetadata httpgetenabled="true"/> <userequestheadersformetadataaddress> <defaultports> <add scheme="http" port="8081"/> <add scheme="https" port="444"/> </defaultports> </userequestheadersformetadataaddress> <datacontractserializer maxitemsinobjectgraph="111024000"/> </behavior> </servicebehaviors> </behaviors> <services> <service name="bandicoot.core" behaviorconfiguration="metadataenabled"> <endpoint name="httpendpoint" address="" binding="wshttpbinding" bindingconfiguration="wshttp" contract="bandicoot.core.irepricer" /> <endpoint name="httpmetadata" address="contract" binding="mexhttpbinding" bindingconfiguration="mexbinding" contract="bandicoot.core.stack" /> <host> <baseaddresses> <add baseaddress="http://localhost/core"/> </baseaddresses> </host> </service> </services> <bindings> <wshttpbinding> <binding name="wshttp" maxreceivedmessagesize="111024000" messageencoding="text" maxbufferpoolsize="111024000" textencoding="utf-8"> <readerquotas maxbytesperread="111024000" maxarraylength="111024000" maxstringcontentlength="111024000"/> <security mode="none"/> </binding> </wshttpbinding> <mexhttpbinding> <binding name="mexbinding"/> </mexhttpbinding> </bindings> <servicehostingenvironment multiplesitebindingsenabled="true" />
does have other suggestions, or there mis-configured in web.config i'm not seeing?
thanks advice!
edit: here settings client's app.config
<bindings> <basichttpbinding> <binding name="basichttpbinding_core" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="14194304" maxbufferpoolsize="14194304" maxreceivedmessagesize="14194304" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true"> <readerquotas maxdepth="1000" maxstringcontentlength="111024000" maxarraylength="111024000" maxbytesperread="1024000" maxnametablecharcount="111024000" /> <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding>
edit: adding addition client information:
<client> <endpoint address="http://localhost:92/core.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_core" contract="core.core" name="basichttpbinding_core" /> </client>
edit: attempted changing service bindings basichttpbinding - config changes:
<basichttpbinding> <binding name="basichttp" maxreceivedmessagesize="111024000" messageencoding="text" maxbufferpoolsize="111024000" textencoding="utf-8"> <readerquotas maxarraylength="111024000" maxbytesperread="111024000" maxstringcontentlength="111024000"/> <security mode="none" /> </binding> </basichttpbinding> <service name="bandicoot.core" behaviorconfiguration="metadataenabled"> <endpoint binding="basichttpbinding" bindingconfiguration="basichttp" contract="bandicoot.core.irepricer" /> <endpoint address="mex" binding="mexhttpbinding" bindingconfiguration="mexbinding" contract="imetadataexchange" /> <host> <baseaddresses> <add baseaddress="http://localhost/core"/> </baseaddresses> </host> </service>
and client's app.config reference:
<bindings> <basichttpbinding> <binding name="basichttpbinding_core" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="65536" maxbufferpoolsize="524288" maxreceivedmessagesize="100000000" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true"> <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" /> <security mode="none"> <transport clientcredentialtype="none" proxycredentialtype="none" realm="" /> <message clientcredentialtype="username" algorithmsuite="default" /> </security> </binding> </basichttpbinding> </bindings> <client> <endpoint address="http://localhost:92/core.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_core" contract="core.core" name="basichttpbinding_core" /> </client>
you need setting maxreceivedmessagesize
on client (where message you're returning service incoming) - in app.config
or web.config
:
<system.servicemodel> <bindings> <wshttpbinding> <binding name="wshttp" maxreceivedmessagesize="111024000" messageencoding="text" maxbufferpoolsize="111024000" textencoding="utf-8"> <readerquotas maxbytesperread="111024000" maxarraylength="111024000" maxstringcontentlength="111024000"/> <security mode="none"/> </binding> </wshttpbinding> <mexhttpbinding> <binding name="mexbinding"/> </mexhttpbinding> </bindings> <client name="whatever"> <endpoint name="httpendpoint" address="" binding="wshttpbinding" bindingconfiguration="wshttp" contract="bandicoot.core.irepricer" /> </client> </system.servicemodel>
the default value maxreceivedmessagesize
64k, unless change it.
Comments
Post a Comment