title: WCF - CODEGEN: Generating message contract since message FileRequest has headers
body: <p>I am aware that there is a similar question <a href="https://stackoverflow.com/questions/2375446/add-service-reference-is-generating-message-contracts">here</a> with no solution.</p>
  
  <p>I'm working on a WCF streaming service over HTTP.</p>
  
  <p>Here are my <code>MessageContract</code></p>
  
  <pre><code>[MessageContract]
  public class FileRequest
  {
      #region Message Header
  
      [MessageHeader(MustUnderstand = true)]
      public Credential Credentials { get; set; }
  
      #endregion
  
      #region Message body
  
      [MessageBodyMember(Order = 1)]
      public FileInfo FileInfo { get; set; }
  
      #endregion
  
      #region Ctor
  
      // ...
  
      #endregion
  
  }
  
  [MessageContract]
  public class FileRequestResponse
  {
      #region Message Header
  
      [MessageHeader(MustUnderstand = true)]
      public FileInfo FileHeader { get; set; }
  
      [MessageHeader(MustUnderstand = true)]
      public OperationResult&lt;bool&gt; OperationResult { get; set; }
  
      #endregion
  
      #region Message Body
  
      [MessageBodyMember]
      public Stream FileStream { get; set; }
  
      #endregion
  
  
      #region Constructor
  
      // ...
  
      #endregion
  
  }
  </code></pre>
  
  <p>Here is my <code>ServiceContract</code></p>
  
  <pre><code>[ServiceContract(Namespace = "https://service.contract.example.com")]
  public interface IUpdateService
  {
      [OperationContract(Action = "GetUpdates")]
      OperationResult&lt;List&lt;FileInfo&gt;&gt; GetUpates(ApplicationInfo applicationInfo, Credential credential);
  
      [OperationContract(Action = "GetFile")]
      FileRequestResponse FileRequest(FileRequest fileRequest);
  }
  </code></pre>
  
  <p>Now the question is why I am getting this error:</p>
  
  <blockquote>
    <p>// CODEGEN: Generating message
    contract since message FileRequest has
    headers</p>
  </blockquote>
  
  <p>When I add my service reference. The end result is that the service contract wraps the FileRequest operation into a wrapper which I do not want.</p>
  
  <pre><code>public FileInfo FileRequest(Credential Credentials, FileInfo, out OperationResult&lt;bool&gt; OperationResult, out System.IO.Stream FileStream)
  </code></pre>
  
  <p><strong>NOTE:</strong>
  I have not checked the "Always generate message contracts" in the service reference.</p>