title: EntityFramework with WCF - how to return EF entities
body: <p>I have a WCF service which works, but it uses Standard ADO.net to call some stored procedures.</p>
  
  <p>This is a bit messy and annoying to maintain because any stored procs i call, i have to map to DataContracts i have to create manually and then return as JSON.</p>
  
  <p>I would like to convert the WCF service to return EntityFramework entities (so i dont have to keep mapping and creating datacontracts manually).</p>
  
  <p>I have something like this in my method, eg:</p>
  
  <pre><code>public List&lt;GetStuff_Result&gt; GetStuff(string param1)
  {
              ...
  
              StuffEntities ctx = new DataContracts.StuffEntities();
  
              List&lt;GetStuff_Result&gt; list = ctx.GetStuff(5463, "test").ToList();
  
              return list;
  }
  </code></pre>
  
  <p>I have setup the stored proc in the edmx model to return a GetStuff_Result (i imported the stored procedure and used the "create complex function")</p>
  
  <p>I have debugged this, and i get 2 results in the list, but when my WCF method is called via the browser, i get a message on the browser (chrome):</p>
  
  <pre><code>No data received
  Unable to load the web page because the server sent no data.
  Here are some suggestions:
  Reload this web page later.
  Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data. 
  </code></pre>
  
  <p>Can anyone tell me how to fix this or at least why it's happening?</p>
  
  <p>note (1): i have also right clicked on the edmx file and disabled lazy loading.</p>
  
  <p>note (2): i have setup a DbContext generator</p>
  
  <p>note (3): i use response format of WebMessageFormat.Json</p>
  
  <p>thanks</p>