Getting The remote server returned an unexpected response: (400) Bad Request exception while calling WCF
I am trying to call WCF method from my MVC application. While calling the WCF method, I am getting the "The remote server returned an unexpected response: (400) Bad Request" error.
I am passing a list of items. if I am passing only 50, its going in, but if its morethan that, it is showing the error message.
Any help on this will be greatly appreciated.
My client config:
<basicHttpBinding>
<binding name="BasicHttpBinding_IPaymentRequestService"
closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00"
allowCookies="false" bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="StreamedRequest"
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>
Server Config:
<services>
<service name="BasicHttpBinding_IPaymentRequestService" >
<endpoint name="BasicEndpoint"
address="http://localhost/Intel.IIP.WCF.Hosting/PaymentRequestServiceHost.svc"
binding="basicHttpBinding" bindingConfiguration="ServiceBinding"
contract="IPaymentRequestService">
</endpoint>
</service>
</services>
<bindings>
<basicHttpBinding >
<binding name="ServiceBinding"
transferMode="StreamedRequest" allowCookies="false" useDefaultWebProxy="true"
messageEncoding="Text" hostNameComparisonMode="StrongWildcard"
bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" textEncoding="utf-8"
开发者_如何学JAVA closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<readerQuotas
maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxDepth="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647"/>
<security mode="None" ></security>
</binding>
</basicHttpBinding>
</bindings>
Regards Amal
Did you try:
<system.web>
<httpRuntime maxRequestLength="2097151" />
</system.web>
精彩评论