title: How can I use HttpRequestMessage.CreateResponse<HttpError>() in ASP.NET 5
body: <p>I have empty Web API project as well as full MVC project created using VS2015. I notice <code>HttpRequestMessage</code> is in <code>System.Net.Http</code>, thats fine but not for the <code>CreateResponse</code> below:</p>
  
  <p>This code is from my exception logger middleware that also return formatted json from previous Web API 2.</p>
  
  <pre><code>var resp = request.CreateResponse&lt;HttpError&gt;(HttpStatusCode.InternalServerError, new HttpError("Internal Server Error. Reference: " + guid), config);
  </code></pre>
  
  <p>I am struggling to find out the <code>CreateResponse</code> extension method that supposedly available in <code>System.Net.Http.HttpRequestMessageExtensions</code> as well as <code>HttpError</code> class. Both previously in  <code>Microsoft.AspNet.WebApi.Core</code> package.</p>
  
  <p>After looking on ASP.NET 5 code, I believe it is only available in <a href="https://github.com/aspnet/Mvc/tree/6.0.0-beta6/src/Microsoft.AspNet.Mvc.WebApiCompatShim" rel="noreferrer"><code>Microsoft.AspNet.Mvc.WebApiCompatShim</code></a>. However it does not included in MVC sample project.</p>
  
  <p><strong>Questions:</strong></p>
  
  <p>What is <code>WebApiCompatShim</code> package and can I safely use it in the project?</p>
  
  <p>What is the right way to <code>CreateResponse</code> from <code>HttpRequestMessage</code>?</p>
  
  <p><strong>Update</strong></p>
  
  <p><a href="https://github.com/aspnet/Mvc/blob/6.0.0-beta8/test/WebSites/WebApiCompatShimWebSite/readme.md" rel="noreferrer">This WebApiCompatShimWebSite</a> shows that <code>WebApiCompatShim</code> is</p>
  
  <blockquote>
    <p>to get Web API 2.* like behavior</p>
  </blockquote>
  
  <p>So seems just for compatibility purpose. I have to restructure the code. Now I discover the MVC doesn't have any message handlers feature and seems custom middleware is the way to go.</p>