title: WCF JSON implementation
body: <p>I'm trying to implement a very simple WCF service that returns JSON. I'm trying for 6 hours now and it still doesn't work. I hope you can help me out with this.</p>
  
  <p><strong>Person</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Runtime.Serialization;
  
  namespace Tcf.AtX.Services
  {
      [DataContract]
      public class Person
      {
          [DataMember]
          public string Name { get; set; }
      }
  }
  </code></pre>
  
  <p><strong>Service Contract</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  
  namespace Tcf.AtX.Services
  {
      [ServiceContract]
      public interface IBroadcastService
      {
          /// &lt;summary&gt;
          /// Broadcasts the specified message.
          /// &lt;/summary&gt;
          /// &lt;param name="message"&gt;The message.&lt;/param&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          [OperationContract]
          [WebInvoke(Method="GET", ResponseFormat= WebMessageFormat.Json)]
          Person Broadcast(string message);
      }
  }
  </code></pre>
  
  <p><strong>Service Implementation</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using Tcf.AtX.Broadcasting;
  
  namespace Tcf.AtX.Services
  {
      public class BroadcastService : IBroadcastService
      {
          /// &lt;summary&gt;
          /// Broadcasts the specified message.
          /// &lt;/summary&gt;
          /// &lt;param name="message"&gt;The message.&lt;/param&gt;
          /// &lt;returns&gt;&lt;/returns&gt;
          public Person Broadcast(string message)
          {
              return new Person() { Name = message };
          }
      }
  }
  </code></pre>
  
  <p><strong>Configuration</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
  
    &lt;system.web&gt;
      &lt;compilation debug="true"/&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service name="Tcf.AtX.Services.BroadcastService"&gt;
          &lt;endpoint address="" binding="webHttpBinding" contract="Tcf.AtX.Services.IBroadcastService" behaviorConfiguration="json"/&gt;
          &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /&gt;
          &lt;host&gt;
            &lt;baseAddresses&gt;
              &lt;add baseAddress="http://localhost:8732/Design_Time_Addresses/Tcf.AtX.Services/BroadcastService/" /&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;endpointBehaviors&gt;
          &lt;behavior name="json"&gt;
            &lt;webHttp /&gt;
          &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name=""&gt;
            &lt;serviceMetadata httpGetEnabled="true"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
    &lt;/system.serviceModel&gt;
  
  &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt;&lt;/configuration&gt;
  </code></pre>
  
  <p>The problem is that i don't see the service inside the test client, so i can't test my method. 
  I also wrote a test client myself, but i can't create an instance of my service when i reference it to my project.</p>
  
  <p>Can someone please explain to me what i'm doing wrong?</p>
  
  <p>Best regards,</p>
  
  <p>Rob</p>