Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 470205
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:51:41+00:00 2026-05-12T23:51:41+00:00

I’m truly stumped. I’ve tried every tool imaginable, checked every resource I can, and

  • 0

I’m truly stumped. I’ve tried every tool imaginable, checked every resource I can, and still can’t make sense of this.

I have a WCF service designed to handle plain old XML requests in a proprietary XML format (this is an old ASMX conversion). I’ve setup the service using the WCF 3.5 to accept plain HTTP POST requests, and it works beautifully as long as the Content-Type in the request header is not set to “text/xml” (or any other XML or JSON type, such as “text/json” or “application/json”).

In other words, if I set the content type of the request to “text” or “text/plain” or even “whatever”, the service works as expected. However, when I set the content type to “text/xml”, the service fails with an HTTP 400 Bad Request.

And I’ve failed to find a way to debug the failure to get some more information. The actual service method is never called, and implementing IErrorHandler didn’t catch an error either. I’m suspecting something is wrong with my WCF config or with my IIS 7 setup, but I’m absolutely clueless as to what is going on.

Here’s my service contract:

using System.ServiceModel;
using System.ServiceModel.Web;
using System.IO;

namespace App.api.v_1_1
{
    [ServiceContract]
    public interface IPlainXmlWebServiceViaHttpPost
 {
        [WebInvoke(UriTemplate = "", BodyStyle = WebMessageBodyStyle.Bare, Method = "POST", RequestFormat = WebMessageFormat.Xml, ResponseFormat = WebMessageFormat.Xml)]
        [OperationContract]
  Stream Process(Stream xml);
 }
}

And here’s my service implementation:

using System.IO;
using System.ServiceModel.Activation;
using App.api.v_1_0;
using System.ServiceModel;

namespace App.api.v_1_1
{
    [ServiceBehavior(Namespace = Constants.WebServiceNamespace)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class PlainXmlWebServiceViaHttpPost : IPlainXmlWebServiceViaHttpPost
 {
        public Stream Process(Stream request)
        {
            return request.ProcessTextStreamWith(PoxProcessor.Process);
        }
 }
}

Basically it’s just turning the incoming Stream into a string, doing something with that string, and returning a string response converted back into a Stream. The idea is to be able to pass arbitrary XML to the service and return arbitrary XML.

And, finally, here’s the relevant portion of the web.config:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    <bindings>
        <webHttpBinding>
            <binding name="poxBinding" maxReceivedMessageSize="655360">
                <readerQuotas maxArrayLength="655360" />
                <security mode="None">
                    <transport clientCredentialType="None" />
                </security>
            </binding>
        </webHttpBinding>
    </bindings>
    <behaviors>
        <endpointBehaviors>
            <behavior name="REST">
                <webHttp />
            </behavior>
        </endpointBehaviors>
        <serviceBehaviors>
            <behavior name="poxBehavior">
                <serviceDebug httpHelpPageEnabled="false" includeExceptionDetailInFaults="true" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="poxBehavior" name="App.api.v_1_1.PlainXmlWebServiceViaHttpPost">
            <endpoint address="" behaviorConfiguration="REST" binding="webHttpBinding"
                bindingConfiguration="poxBinding" contract="App.api.v_1_1.IPlainXmlWebServiceViaHttpPost" />
        </service>
    </services>
</system.serviceModel>

I’ve been trying all sorts of workarounds to get WCF/IIS to cooperate with me, and all have failed. Does anyone know what would cause requesting the expected content types to return HTTP 400, but all other content types to be processed as expected?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:51:41+00:00Added an answer on May 12, 2026 at 11:51 pm

    Did you use WebServiceHostFactory in your .svc file:

    <%@ ServiceHost 
        Factory="System.ServiceModel.Activation.WebServiceHostFactory"   
        Service="App.api.v_1_1.PlainXmlWebServiceViaHttpPost" 
    %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.