title: Getting The connection to localhost was interrupted. When trying to send a JSON representation of a [DataContract] marked object
body: <p>I am using the following method to send a <strong>JSON representation</strong> of a List of a custom object through a WCF service hosted on my local machine:</p>
  
  <pre><code> [OperationContract]
      [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json,
                 ResponseFormat = WebMessageFormat.Json)]
      public List&lt;MyObject&gt; GetObjects()
      {
          return MyObject.GetObjects();
      }
  </code></pre>
  
  <p>The class MyObject is marked with the [DataContract] attribute, When I request the method using Rest URL, I get the error </p>
  
  <blockquote>
    <p>This webpage is not available, The connection to localhost was interrupted.</p>
  </blockquote>
  
  <p>When I remove the <strong>[DataContract]</strong> atribute, it works fine. I read many articles that you should enable SSL and configure the service behavior to set the certificate name and store and that sort of stuff, but isthis the right and only way to make it work? Shouldn't it be straighforward?</p>
  
  <p>The code for MyObject is :</p>
  
  <pre><code>  [DataContract]
  public class MyObject
  {
  
      [DataMember]
      public int ID { get ; set; }
      [DataMember]
      public string Name { get; set; }
      [DataMember]
      public string Description { get; set; }
   }
  </code></pre>