title: WCF REST: specify content-type on WebGet Attribute doesn't seem to be working
body: <p>probably something i doing wrong, but i am returning XML from my WCF Rest service which is built with VS 2010. In fiddler you can see here that it returns test/html as the content-type</p>
  
  <pre><code> HTTP/1.1 200 OK
   Cache-Control: private
   Content-Length: 222
   Content-Type: text/html; charset=utf-8
   Server: Microsoft-IIS/7.5
   X-AspNet-Version: 4.0.30319
   X-Powered-By: ASP.NET
   Date: Mon, 16 Aug 2010 20:49:55 GMT
  </code></pre>
  
  <p>So i went ahead and added the following on the webget attribute on my method but it still returns text/html ... I presume that i should return the content type of text/xml because i am in fact returning XML?</p>
  
  <p>Heres my method, i added the ResponseFormat to the attribute...  I wasn't sure if i needed bodystyle (i have no idea what it does but saw it in an example :-) )</p>
  
  <pre><code>    [WebGet(UriTemplate = "", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Xml)]
      public List&lt;SampleItem&gt; GetCollection()
      {
          // TODO: Replace the current implementation to return a collection of SampleItem instances
          return new List&lt;SampleItem&gt;() { new SampleItem() { Id = 1, StringValue = "Hello" } };
      }
  </code></pre>
  
  <p>anyway after the change and rebuilding of the project it still returns the wrong content type ... am i missign somthing?</p>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: private
  Content-Length: 222
  Content-Type: text/html; charset=utf-8
  Server: Microsoft-IIS/7.5
  X-AspNet-Version: 4.0.30319
  X-Powered-By: ASP.NET
  Date: Mon, 16 Aug 2010 20:54:15 GMT
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Ok i got a working solution but the attribute method has NO EFFECT, very strange...but if i put this </p>
  
  <pre><code>  WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
  </code></pre>
  
  <p>Now i check fiddler and the content-type is actually text/xml.</p>
  
  <p>But i need to put this in every method and the attribute method seems to have no effect.</p>
  
  <p>Anybody know why?</p>