basil365
asked on
WCF (400) Bad Request error
Hi,
I have a web service which i am calling with varying amounts of data. when i pass smaller amounts of data it works fine, but when i pass more i get the (400) Bad Request error. The memory footprint of my whole app in taskmanager is ~44mb which doesn't seem excessive to me.
I am running the app in this configuration - Solution file with 3 projects:
1 - wcf web service (published and running on local iis)
2 - class library with the reference to the web service
3 - test windows forms project to call the class library
i have set these values in the web.config of the service project
and copied the same values into the app.config of both the other projects.
Can somebody enlighten me as to why i cannot pass the extra data?
I have a web service which i am calling with varying amounts of data. when i pass smaller amounts of data it works fine, but when i pass more i get the (400) Bad Request error. The memory footprint of my whole app in taskmanager is ~44mb which doesn't seem excessive to me.
I am running the app in this configuration - Solution file with 3 projects:
1 - wcf web service (published and running on local iis)
2 - class library with the reference to the web service
3 - test windows forms project to call the class library
i have set these values in the web.config of the service project
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IPeService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01: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/PeService/PeService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IPeService"
contract="PeService.IPeService" name="BasicHttpBinding_IPeService" />
</client>
<behaviors>
<serviceBehaviors>
and copied the same values into the app.config of both the other projects.
Can somebody enlighten me as to why i cannot pass the extra data?
ASKER
thanks for replying, i cant find anything there that solves the issue, however i noticed that if i delete my app.config file and regenerate it by refreshing the service reference in VS i get default values for all the max sizes instead of the values i've specified in the web.config file.
Does anybody know why this is?
Does anybody know why this is?
check with fiddler if there is something wrong.
ASKER
how can i do this?
I have been checking the request and it looks fine (just more information in the soap envelope when send data)
Or do you mean check the response when generating the config?
I have been checking the request and it looks fine (just more information in the soap envelope when send data)
Or do you mean check the response when generating the config?
ASKER
i get this response error:
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.
on this call when updating the service:
POST http://localhost./peservice/Peservice.svc/mex HTTP/1.1
HTTP/1.1 415 Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'.
on this call when updating the service:
POST http://localhost./peservice/Peservice.svc/mex HTTP/1.1
How did you added the reference ? as Service reference or as web service reference ? in your client project .
ASKER
As a service refernce
Should you go to "Advance options" and add as web serivice since it is a web service.
ASKER
thanks, ill try that, but the call does work with smaller quantities of data - it just seems that the web.config is not being interpreted correctly
Can we see your service config as well.
ASKER
Im sorry - im unsure which file this is?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
see if this helps you
http://stackoverflow.com/questions/784606/large-wcf-web-service-request-failing-with-400-http-bad-request
http://www.vistax64.com/indigo/141163-fix-wcf-remote-server-returned-error-400-bad-request.html
Thanks and regards,
Venki