The WCF fault "The remote server returned an unexpected response: (400) Bad Request.", might be caused by some quota or timeout on server / client side.The solution is to increase reader quota values from binding configuration on both sides:
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2000000" maxReceivedMessageSize="2000000"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000"
maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service name="MyService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService" contract="MyIService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
</service>
</services>
13 comments:
thanks for saving me some hours of digging.
Just in case you run into this - copy and paste the
bindings
wsHttpBinding
/wsHttpBinding
bindings
and
bindingConfiguration="WSHttpBinding_IResumeWebService"
into the WCF server web.config too
Great!
Thanks for this posting. I am implementing a WCF based solution and all was working fine until I started to process larger quantities of data. Been scratching my bald head for a day or so. All works fine now thanks.!!
Happy New Year!
Thanks for the tip. Exactly what I was looking for!
I'm also facing same 404 error.
Sahil, can you please make it clear, do we need to copy and paste the
bindings
wsHttpBinding
/wsHttpBinding
bindings
and
bindingConfiguration="WSHttpBinding_IResumeWebService"
into the WCF server web.config
Thanks for this posting
I have made the changes in the client binding but still facing the same error.
I have made the changes to the client binding but I am facing the same error.
Sahil said...
Just in case you run into this - copy and paste the
bindings
wsHttpBinding
/wsHttpBinding
bindings
and
bindingConfiguration="WSHttpBinding_IResumeWebService"
into the WCF server web.config too
>>>>>>>>>
Worked for me, thanks sahil
Hey Thanks for the solution,
But just a question, we have changed the data size to 200000 everywhere, do you know specific location where we have to change or we have to change it everywhere.
FYI, Bad Request can also happen if maxReceivedMessageSize on your server binding is too short, for the incoming client-to-server message size.
Thx for this article, it helped me very much.
Essa configuração deve ser colocada no arquivo de configuração do serviço ou do cliente?
Sim deve ser colocada no serviço e no cliente
Post a Comment