title: How to upload a file to a .NET 3.5 WCF service hosted in IIS?
body: <p>I've been ripping my hair out for a while now.  Can someone provide a really simple example (or a link to a working example) of how to upload a file to a WCF service hosted in IIS.  </p>
  
  <p>I've started with something simple.  I want to call a URL from a client via POST, pass the name of the file and send the file as well.  So I added the following to the contract:  </p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST", UriTemplate = "/UploadFile?fileName={fileName}")]
  void Upload(string fileName, Stream stream);
  </code></pre>
  
  <p>The implemented it in the .svc file:</p>
  
  <pre><code>public void Upload(string fileName, Stream stream)
  {
      Debug.WriteLine((fileName));
  }
  </code></pre>
  
  <p>Immediately, I get an error upon running the project:</p>
  
  <p><code>For request in operation Upload to be a stream the operation must have a single parameter whose type is Stream.</code></p>
  
  <p>Not sure where to go from here.  Would love to see an actual working example.</p>
  
  <p>P.S.  I did this in .NET 4 with WCF 4 and it seemed a lot simpler, but I've had to downgrade.  In .NET 3.5, I am missing something.  </p>