none
WCF Service failing - HTTP/1.1 400 Bad Request[\r][\n] RRS feed

  • Question

  • Hi All,

    I was getting exception while making a call the my WCF service more larger request xml object content length 65708, where it is working without any issues with request xml file content length less than this. This is service we are exposed to external clients and I used SoapUI to debug the service and I am getting the exception HTTP/1.1 400 Bad Request[\r][\n] and not even hitting to the debug point. I goggled a lot and applied the configuration values provided, but none of them helped me to resolve the issue. 

    After all the config changes, my web.config file is looks like this (only binding part).
    <bindings>
          <basicHttpBinding>
            <binding name="GDASHttp" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Streamed" useDefaultWebProxy="true">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
              <security mode="TransportCredentialOnly">
                <transport clientCredentialType="Windows"/>
              </security>
            </binding>
    </basicHttpBinding>

    I didn't changed any settings in the client file as I can getting the exception from SoapUI and issue is related to server configuration only. I do understand the issue with some the settings is accepting according to the file size, but not sure what is maximum values we can provide in the above settings.

    I modified the IIS settings as per some of the Google advises in  the server and this is my changed applicationhost.config file. 

    <location path="Default Web Site/GDAS.FY15R2.3.1/Trusted" overrideMode="Allow">
            <system.webServer>
                <handlers accessPolicy="Read, Execute" />
                <security>
                    <ipSecurity>
                        <add ipAddress="127.0.0.1" subnetMask="255.255.255.255" allowed="true" />
                    </ipSecurity>
                            <requestFiltering> 
                            <requestLimits maxAllowedContentLength="40000000" /> 
                            </requestFiltering> 
                </security>
                <serverRuntime uploadReadAheadSize="2147483647" />
            </system.webServer>
        </location>

    Is anyone can help me to resolve this issue asap as I am sitting on this issue in the last 3-4 days but none the settings is help me till now. I am greatly appreciated your helps and supports.

    Thanks,
    Bins
    • Moved by Kristin Xie Wednesday, September 10, 2014 7:02 AM
    • Moved by Kristin Xie Wednesday, September 10, 2014 7:04 AM
    Tuesday, September 9, 2014 2:25 PM

Answers

  • I don't think you have done anything on the service-side config to change the bindings and they are still setting at default values.

    http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/

    You have to use a custom binding on the service-side config and point the service behavior at the custom binding to chage default values. You can use Bing or Google on how to use custom bindings on the service side config.

    In oeder to test against the service, then you would need to install Resharper. You would crreate a classlib project call it WCFTesting or something.

    You would also be using a testing famework like Nunit or something to have test methods in WCFTesting.

    WCFTesting project would consume the WCF service. Resharper would host the WCFTesting project, which is the only test harness powerful enough, to do the fuctional testing of the WCF service where you can set a breakpoint in a test method in WCFTesting project and single step into the code on the WCF Service side.

    Wednesday, September 10, 2014 1:32 PM

All replies

  • Well, did you go to the IIS logs to see if you get anymore explantion about the 400 error? Also, you only addressed the client-side web.config and increasing max lengths. What about the service-side Web.config if you have to send data vack to the service?
    Tuesday, September 9, 2014 2:45 PM
  • Hi, I have given the server side configuration details only, but I didn't compared and matched with client side config, why because I was using the SoapUI and client is an external team and it is really tough the team to ask every time to change the values and test it.

    Is there any alternative ways we can test this other than SoapUI?

    Wednesday, September 10, 2014 5:49 AM
  • After changing the configuration here and there now the exception description is got changed in fiddler.

    HTTP/1.1 413 Request Entity Too Large

    

    Wednesday, September 10, 2014 7:02 AM
  • Hi Bins,

    Like the title you mentioned, this is a WCF case. So i have moved your case to WCF forum.

    Have a nice day!

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, September 10, 2014 7:04 AM
  • I don't think you have done anything on the service-side config to change the bindings and they are still setting at default values.

    http://robbincremers.me/2012/01/01/wcf-custom-binding-by-configuration-and-by-binding-standardbindingelement-and-standardbindingcollectionelement/

    You have to use a custom binding on the service-side config and point the service behavior at the custom binding to chage default values. You can use Bing or Google on how to use custom bindings on the service side config.

    In oeder to test against the service, then you would need to install Resharper. You would crreate a classlib project call it WCFTesting or something.

    You would also be using a testing famework like Nunit or something to have test methods in WCFTesting.

    WCFTesting project would consume the WCF service. Resharper would host the WCFTesting project, which is the only test harness powerful enough, to do the fuctional testing of the WCF service where you can set a breakpoint in a test method in WCFTesting project and single step into the code on the WCF Service side.

    Wednesday, September 10, 2014 1:32 PM