Search code examples
wcfbase64http-status-code-400

WCF 4 REST Template and base64 strings - HTTP 400


I am trying to submit a long (approx. 155000 characters) base64 string to a WCF REST service using the wcf 4 REST template made available by Microsoft. Whenever I try submitting the the the XML through the post method either from the client application or fiddler I get a HTTP status code 400 in response to my request. I have the appropriate web.config settings, pieced together from various blog posts and other stackoverflow posts.

   <bindings>
      <webHttpBinding>
        <binding name="httpBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" transferMode="Streamed"  openTimeout="00:25:00" closeTimeout="00:25:00" sendTimeout="00:25:00" receiveTimeout="00:25:00">
          <readerQuotas maxDepth="64"
                 maxStringContentLength="2147483647"
                 maxArrayLength="2147483647"
                 maxBytesPerRead="2147483647"
                 maxNameTableCharCount="2147483647"/>
        </binding>
      </webHttpBinding>
    </bindings>  

what am I missing here? Everything else works great; I submit requests that are text/xml format to the service and everything else returns 200, as long as I'm not working with the base64 string. I know there are a million other posts about wcf message size, but I would appreciate it somebody would take a quick look at mine.

Here is a link to the sample request I am trying to get the wcf service to handle.

I would appreciate any thoughts anybody might have.


Solution

  • Try enabling tracing at the server side to see what is causing the server to reject the request. Also, double check that:

    • The <endpoint> element for your service has a bindingConfiguration attribute with value "httpBinding"
    • The <service> element for your service a name attribute which matches the fully-qualified name of the service class (i.e., with the namespace, essentially the same value you use in the .svc file).