title: IErrorHandler Get Original Message
body: <p>I have a WCF error handler that uses the IErrorHandler interface. In the HandleError method of this error handler I write the error exception to the log. This all works fine. However, I have a requirement to also write the actual message that raised the exception to the log as well and this is not something passed into the HandleError method.</p>
  
  <p>So, I have been looking at OperationContext to see if that helps by doing something like the following:</p>
  
  <pre><code>MessageBuffer buffer = OperationContext.Current.RequestContext.RequestMessage.CreateBufferedCopy(int.MaxValue);
  
  Message message = buffer.CreateMessage();
  using (XmlDictionaryReader reader = message.GetReaderAtBodyContents())
  {
     string content = reader.ReadContentAsString();
  }
  </code></pre>
  
  <p>However, I keep getting "This message cannot support the operation because it has been copied" as I assume the message has been copied previously somewhere by the framework? Anyway, I am now at a loss as to how to achieve the functionality required. Does anyone have any suggestions?</p>
  
  <p>Thanks in advance</p>