title: Asp.Net WebApi Custom Media Formatter not matching a particular type
body: <p>I'm checking out web api's content negotiation and custom formatters and trying to use a generic custom formatter. Using RazorEngine I am parsing a razor view to be returned as a response message from a web api controller.</p>
  
  <p>Here is my formatter configuration</p>
  
  <pre><code>        GlobalConfiguration.Configuration.Formatters.Insert(0, new RazorViewFormatter&lt;DefaultViewModel&gt;("home-json", new MediaTypeHeaderValue("text/json"), new MediaTypeHeaderValue("application/json")));
          GlobalConfiguration.Configuration.Formatters.Add(new RazorViewFormatter&lt;DefaultViewModel&gt;("home", new MediaTypeHeaderValue("text/html")));
          GlobalConfiguration.Configuration.Formatters.Add(new RazorViewFormatter&lt;IEnumerable&lt;CategoryViewModel&gt;&gt;("categories-json", new MediaTypeHeaderValue("text/json"), new MediaTypeHeaderValue("application/json")));
          GlobalConfiguration.Configuration.Formatters.Add(new RazorViewFormatter&lt;IEnumerable&lt;CategoryViewModel&gt;&gt;("categories", new MediaTypeHeaderValue("text/html")));
  </code></pre>
  
  <p>Making a request with to my default resource, returns the correctly parsed razor view.</p>
  
  <pre><code>GET http://localhost:56071/api/ HTTP/1.1
  User-Agent: Fiddler
  Accept: text/json
  Host: localhost:56071
  </code></pre>
  
  <p>However making a request to my categories resource, just returns the serialized json of my model rather than the parsed template. Essentially missing the mark the on custom media formatter. WriteToStreamAsync() is never called</p>
  
  <pre><code>GET http://localhost:56071/api/categories HTTP/1.1
  User-Agent: Fiddler
  Accept: text/json
  Host: localhost:56071
  </code></pre>
  
  <p>Is this not a workable approach?  I do get a match on CanReadType, I'm wondering if the multiple formatters and they way conneg is evaluated ends up somehow not matching text/json.</p>
  
  <p>Any thoughts are appreciated. Thanks.</p>
  
  <p><strong>Update</strong></p>
  
  <pre><code>public override bool CanWriteType(Type type)
  {
      return (type == typeof (T) || type.IsSubclassOf(typeof (T)));
  }
  
  public override bool CanReadType(Type type)
  {
      return false;
  }
  </code></pre>