Solved

WCF  (400) Bad Request error

Posted on 2011-09-19
12
1,158 Views
Last Modified: 2013-11-19
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

<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>

Open in new window


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?
0
Comment
Question by:basil365
12 Comments
 
LVL 21

Expert Comment

by:tovvenki
ID: 36566321
0
 

Author Comment

by:basil365
ID: 36567004
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?
0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 36571490
check with fiddler if there is something wrong.
0
 

Author Comment

by:basil365
ID: 36572091
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?
0
 

Author Comment

by:basil365
ID: 36572126
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
0
 
LVL 25

Expert Comment

by:apeter
ID: 36576635
How did you added the reference ? as Service reference or as web service reference ? in your client project .
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:basil365
ID: 36578805
As a service refernce
0
 
LVL 25

Expert Comment

by:apeter
ID: 36583735
Should you go to "Advance options" and add as web serivice since it is a web service.
0
 

Author Comment

by:basil365
ID: 36583753
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
0
 
LVL 25

Expert Comment

by:apeter
ID: 36583824
Can we see your service config as well.
0
 

Author Comment

by:basil365
ID: 36585494
Im sorry - im unsure which file this is?
0
 
LVL 25

Accepted Solution

by:
apeter earned 500 total points
ID: 36591913
Above config. has only client endpoints....asking the same for server endpoints.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now