title: Returning an Image from OperationContract method (WCF service)
body: <p>I'm trying to get an <code>Image</code> from a WCF service.</p>
  
  <p>I have an <code>OperationContract</code> function that returns an <code>Image</code> to the client, but when I call it from the client, 
  I get this exception:</p>
  
  <blockquote>
    <p>The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:59.9619978'.</p>
  </blockquote>
  
  <p>Client:</p>
  
  <pre><code>private void btnNew_Click(object sender, EventArgs e)
  {
      picBox.Picture = client.GetScreenShot();
  }
  </code></pre>
  
  <p>Service.cs:</p>
  
  <pre><code>public Image GetScreenShot()
  {
      Rectangle bounds = Screen.GetBounds(Point.Empty);
      using (Bitmap bmp = new Bitmap(bounds.Width,bounds.Height))
      {
          using (Graphics g = Graphics.FromImage(bmp))
          {
              g.CopyFromScreen(Point.Empty, Point.Empty, bounds.Size);
          }
          using (MemoryStream ms = new MemoryStream())
          {
              bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
              return Image.FromStream(ms);
          }
      }
  }
  </code></pre>
  
  <p><code>IScreenShot</code> Interface:</p>
  
  <pre><code>[ServiceContract]
  public interface IScreenShot
  {
      [OperationContract]
      System.Drawing.Image GetScreenShot();
  }
  </code></pre>
  
  <p>So why is this happening and how do I fix it?</p>