title: Why does my WCF Service have trouble returning custom object?
body: <p>So my question is much like this one: <a href="https://stackoverflow.com/questions/1974562/wcf-service-returning-custom-objects">WCF service: Returning custom objects</a>, however, despite the solutions in that question I see nothing working. </p>
  
  <p>Yesterday I proposed a question related to this one, but I've come closer, if not identified the potential source of my issue.</p>
  
  <p>I don't believe it is problem with the size of the data that I am working with. I can send this data to the server, but I am having a problem with retrieving it. I'm returning an object called <code>ProjectDetails</code> over <code>WCF</code>. However, I run into an issue with receiving it from the service to the client. </p>
  
  <p>Is there a setting that I am missing or is there a way I configured my class for <code>WCF</code> incorrectly?</p>
  
  <p>Here is my <code>ProjectDetails</code> code:</p>
  
  <pre><code>[DataContract]
  public class ProjectDetails 
  {
      [DataMember]
      public int projectId { get; set; }
      [DataMember]
      public string name { get; set; }
      [DataMember]
      public int calYearId { get; set; }
      [DataMember]
      public string projectState { get; set; }
      [DataMember]
      public string reportTitle { get; set; }
      [DataMember]
      public int plantId { get; set; }
      [DataMember]
      public string holdNumber { get; set; }
      [DataMember]
      public string holdDescription { get; set; }
      [DataMember]
      public string remarks { get; set; }
      [DataMember]
      public string adminComments {get; set; }
      [DataMember]
      public int companyId { get; set; }
      [DataMember]
      public int customerId { get; set; }
      [DataMember]
      public string folderNumber { get;  set; }
      [DataMember]
      public int invoicedInFull { get; set; }
      [DataMember]
      public int approved { get; set; }
  }
  </code></pre>
  
  <p>Here is how the it is defined in my Service Contract:</p>
  
  <pre><code>[ServiceContract]
  public interface IProjectService
  {
      [OperationContract]
      ProjectDetails GetProjectDetails(int selected_id);
  }
  </code></pre>
  
  <p>I have regenerated my proxy with <code>svcutil.exe</code> and updated my service reference. However, every time I call the <code>GetProjectDetails</code> method my code fails. I get: </p>
  
  <blockquote>
    <p>The underlying connection was closed: An unexpected error occurred on a receive.</p>
  </blockquote>
  
  <p>Please, if anyone can help, I would be so grateful. </p>
  
  <p><strong>Update</strong></p>
  
  <p>Client side config:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;configuration&gt;
      &lt;system.serviceModel&gt;
          &lt;bindings&gt;
              &lt;basicHttpBinding&gt;
                  &lt;binding name="BasicHttpBinding_IProjectService" /&gt;
              &lt;/basicHttpBinding&gt;
          &lt;/bindings&gt;
          &lt;client&gt;
              &lt;endpoint address="http://192.168.0.99:9000/ProjectService/ProjectService"
                  binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProjectService"
                  contract="IProjectService" name="BasicHttpBinding_IProjectService" /&gt;
          &lt;/client&gt;
       &lt;/system.serviceModel&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Client side config:</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;!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. --&gt;
    &lt;system.serviceModel&gt;
      &lt;services&gt;
        &lt;service behaviorConfiguration="ProjectBaseWCFServiceLib.Service1Behavior" name="ProjectBaseWCFServiceLib.ProjectService"&gt;
          &lt;endpoint address="" binding="basicHttpBinding" contract="ProjectBaseWCFServiceLib.IProjectService"&gt;
            &lt;identity&gt;
              &lt;dns value="localhost"/&gt;
            &lt;/identity&gt;
          &lt;/endpoint&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/ProjectBaseWCFServiceLib/Service1/"/&gt;
            &lt;/baseAddresses&gt;
          &lt;/host&gt;
        &lt;/service&gt;
      &lt;/services&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior name="ProjectBaseWCFServiceLib.Service1Behavior"&gt;
            &lt;!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="True"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information --&gt;
            &lt;dataContractSerializer maxItemsInObjectGraph="2147483646"/&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="True"/&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>Client side code: </p>
  
  <pre><code>        Console.WriteLine("Testing................");
          ProjectBaseWCFServiceLib.ProjectDetails details = client.GetProjectDetails(1);
  
          Console.WriteLine(details.adminComments);
          Console.WriteLine(details.approved);
          Console.WriteLine(details.calYearId);
          Console.WriteLine(details.companyId);
          Console.WriteLine(details.folderNumber);
          Console.WriteLine(details.holdDescription);
          Console.WriteLine(details.holdNumber);
          Console.WriteLine(details.invoicedInFull);
          Console.WriteLine(details.name);
          Console.WriteLine(details.plantId);
          Console.WriteLine(details.projectId);
          Console.WriteLine(details.projectState);
          Console.WriteLine(details.remarks);
          Console.WriteLine(details.reportTitle);
  </code></pre>