title: WCF REST service not returning DataContract object
body: <p>I have a simple WCF service defined by the following ServiceContract:</p>
  
  <pre><code>[ServiceContract]
  public interface IInventoryService
  {
    [OperationContract]      
    Item GetItemFromBarcode(string barcode);
  
    [OperationContract]
    string Test(string testString);
  }
  </code></pre>
  
  <p>With Item defined like this:</p>
  
  <pre><code>[DataContract]
  public class Item
  {
    [DataMember]
    public virtual int Id { get; set; }
  
    &lt;Snip&gt;
  }
  </code></pre>
  
  <p>And the actual service implemented thusly:</p>
  
  <pre><code>public class InventoryService : IInventoryService
  {
    [WebGet(UriTemplate = "/Barcode/{barcode}/Item", ResponseFormat = WebMessageFormat.Json)]
    public Item GetItemFromBarcode(string barcode)
    {
       var item = (from b in repository.Query&lt;ItemBarcode&gt;()
               where b.BarcodeData == barcode
               select b.Item).FirstOrDefault();
       return item;
  
    }
  
    [WebGet(UriTemplate = "/Test/{testString}",ResponseFormat=WebMessageFormat.Xml)]
    public string Test(string testString)
    {
       return testString;
    }
  }
  </code></pre>
  
  <p>With the following in the app.config for the program hosting the service:</p>
  
  <pre><code>&lt;system.serviceModel&gt;      
    &lt;behaviors&gt;
       &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
             &lt;serviceMetadata httpGetEnabled="true"/&gt;
          &lt;/behavior&gt;
       &lt;/serviceBehaviors&gt;
       &lt;endpointBehaviors&gt;
          &lt;behavior name="RESTFriendly"&gt;
             &lt;webHttp /&gt;
          &lt;/behavior&gt;
       &lt;/endpointBehaviors&gt;
    &lt;/behaviors&gt;
    &lt;services&gt;
       &lt;service name="InventoryService"&gt;            
          &lt;endpoint address="/Inventory" behaviorConfiguration="RESTFriendly" binding="webHttpBinding" contract="IInventoryService"/&gt;
          &lt;host&gt;
             &lt;baseAddresses&gt;
                &lt;add baseAddress="http://localhost:8080/"/&gt;
             &lt;/baseAddresses&gt;
          &lt;/host&gt;
       &lt;/service&gt;
    &lt;/services&gt;
  &lt;/system.serviceModel&gt;
  </code></pre>
  
  <p>Now that the code dump is out of the way, the issue: I can invoke the <code>Test</code> method just fine with curl or Fiddler, it returns a serialized string. However, invoking the method that returns an object returns nothing. Curl spits back <code>curl: (56) Failure when receiving data from the peer</code> and Fiddler responds <code>ReadResponse() failed: The server did not return a response for this request.</code></p>
  
  <p>From what I read, this should Just Work (tm). Is there something obvious I'm missing?</p>