views:

99

answers:

0

I have a straight forward service like:

[ServiceContract]
public interface IService
{
        [WebGet(UriTemplate = "/", ResponseFormat = WebMessageFormat.Xml)]        
        [OperationContract]
        List<DataContracts.MyThing> Get();
}

My datacontract is straightfoward, nothing unusual there:

[DataContract]
public class MyThing 
{
    [DataMember]
    public string ID { get; set;}
}

I'm using the WebServiceHostFactory instead of manual binding.

When I run this on IIS 5.1 (Windows XP, my local dev environment), I get a return like:

<ArrayOfMyThing>
    <MyThing></MyThing>
</ArrayOfMyThing>

However, when I drop the exact same code on IIS 6.0 in a production box, I get a return like:

<ArrayOfMyThing 
    xmlns="http://schemas.datacontract.org/2004/07/My.NameSpace.DataContracts"  
    xmlns:i="http://www.w3.org/2001/XMLSchema-instance"http://my.website.com/services/&gt;
</ArrayOfMyThing>

So my question is twofold:

  1. Why is it not serving namespaces on my local development environment?
  2. Why is it creating bad XML by appending the base path to the service inside the tag?

Obviously the bad XML node breaks any parser, so this is absolutely useless to me. Oddly enough, this is only happening on that particular service method, all the others work fine, and are configured the same way.

EDIT: When I use JSON, everything looks good, so I don't think this is an issue with WCF. It has to be a serializer issue.