title: Return images to web page using Web Api
body: <p>I have a self-hosted Web Api console app. I've got it to serve up HTML. Within the HTML page there is a link to an image (the image is known at compile time). I have tried and failed to write a controller method to retrieve the image and send it on to the html page. See below. My image is stored as a linked resource.</p>
  
  <pre><code>public class ResourceFilesController : ApiController
  {
    public HttpResponseMessage Get()
    {
  
      Stream dataStream =
        System.Reflection.Assembly.GetEntryAssembly().
          GetManifestResourceStream("Properties.Resources.img2");
  
      HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.OK);
  
      //Get argumentNull exception on this line
      response.Content = new StreamContent(dataStream);
  
      return response;
    }
  }
  </code></pre>