title: WCF Message Contract and Streaming
body: <p>I'm going boarder line crazy, I have been working with this for over a day and still have no idea why it doesn't work,</p>
  
  <p>I have a MessageContract that I'm using to send out a stream, but I get the following error,</p>
  
  <blockquote>
    <p>Type 'System.IO.FileStream' with data
    contract name
    'FileStream:<a href="http://schemas.datacontract.org/2004/07/System.IO" rel="nofollow noreferrer">http://schemas.datacontract.org/2004/07/System.IO</a>'
    is not expected. Add any types not
    known statically to the list of known
    types - for example, by using the
    KnownTypeAttribute attribute or by
    adding them to the list of known types
    passed to DataContractSerializer.</p>
  </blockquote>
  
  <pre><code>[ServiceContract()]
  public interface IContentService
  {
      [OperationContract(), FaultContract(typeof(ContentFault))]
      PublishItemResponse PublishFile(PublishFileRequest request);
  }
  
  
  [MessageContract()]
  public class PublishFileRequest
  { 
   [MessageHeader()]
   public FileInventoryItem Item {get;set;}
  
   [MessageHeader()]
   public Request Request  {get;set;}
  
   [MessageBodyMember()]
   public Stream FileContent {get;set;}
  }
  
  
  
   [MessageContract()]
   public class Request
   {
    [MessageHeader()]
    public Guid AuthorizationToken { get; set; }
  
    [MessageHeader()]
    public string CoreVersion  { get; set; }
  
    [MessageHeader()]
    public string Password { get; set; }
  
    [MessageHeader()]
    public DateTime RequestTime { get; set; }
  
    [MessageHeader()]
    public string ComponentVersion { get; set; }
  
    [MessageHeader()]
    public string UserName  { get; set; }
   }
  
  
  
  [MessageContract()]
  [Serializable()]
  public class FileInventoryItem : InventoryItemBase
  {
   public Stream FileContent { get; set;}
  }
  
  
  
  [MessageContract()]
  [KnownType(typeof(FileInventoryItem))]
  [KnownType(typeof(FolderInventoryItem))]
  [Serializable()]
  public abstract class InventoryItemBase
  {
   public List&lt;string&gt; Errors {get;set;}
  
   public List&lt;string&gt; Warnings  {get;set;}
  
   [MessageHeader()]
   public StagingAction Action {get;set;}
  
   [MessageHeader()]
   public string ContentXml  {get;set;}
  
   [MessageHeader()]
   public int ItemId {get;set;}
  
   [MessageHeader()]
   public ItemType ItemType { {get;set;}
  
   [MessageHeader()]
   public string Name  {get;set;}
  
   [MessageHeader()]
   public int ParentId {get;set;}
  
   [MessageHeader()]
   public Guid ParentUniqueId  {get;set;}
  
   [MessageHeader()]
   public Guid UniqueId  {get;set;}
  
   [MessageHeader()]
   public Guid Version  {get;set;}
  }
  </code></pre>
  
  <p>Any help is greatly appropriated, </p>