How to remove default header from WCF REST Outgoing Response?

Posted by bmsantos on Stack Overflow See other posts from Stack Overflow or by bmsantos
Published on 2010-06-15T18:18:24Z Indexed on 2010/06/15 18:22 UTC
Read the original article Hit count: 525

Filed under:
|
|
|
|

The following C# WCF based REST service gives me some undesired headers that I'm not sure if I can remove them trough the API.

The interface:

[ServiceContract]
public interface IControlSystem
{
    [OperationContract]
    [WebGet]
    System.IO.Stream About();
}

The implementation:

public class ControlSystem : IControlSystem
{
    public System.IO.Stream About()
    {
        return new System.IO.MemoryStream(ASCIIEncoding.Default.GetBytes("Hello World"));
    }
}

Out of a raw socket connection it gives the following response:

HTTP/1.1 200 OK Server: ASP.NET Development Server/9.0.0.0 Date: Tue, 15 Jun 2010 13:12:51 GMT X-AspNet-Version: 2.0.50727 Cache-Control: private Content-Type: application/octet-stream Content-Length: 39 Connection: Close

Hello World

Question is, is it possible to get the server to not report anything other than the actual message? Need it in some calls so due to some small embedded device clients that will try to connect to the server and I would like to minimize the amount of parsing.

Thanks, B.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET