title: Get WebClient errors as string
body: <p>I have a diagnostic tool which tests a web service.</p>
  
  <p>I want the tool to report when there are problems, so I have deployed a service with a problem with the contract to test it.</p>
  
  <p>When I browse to it I get a page with a very descriptive message such as:</p>
  
  <blockquote>
    <p>An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, 
        whose value is:
        System.InvalidOperationException: An exception was thrown in a call to a WSDL 
        export extension:<br>
        System.ServiceModel.Description.DataContractSerializerOperationBehavior
        contract: DataContract for type XXX cannot be added to DataContractSet since type
        XXX with the same data contract name XXX in namespace XXX is already present
        and the contracts are not equivalent etc..</p>
  </blockquote>
  
  <p>What I want is to be able to call:</p>
  
  <pre><code>myErrorMsg = WebClient.DownloadString("MyBadService.svc");
  </code></pre>
  
  <p>and get this useful error message as a string, however I get the following WebException:</p>
  
  <blockquote>
    <p>The remote server returned an error: (500) Internal Server Error.</p>
  </blockquote>
  
  <p>How can I get the same error message I received in the browser returned as a string, without getting an exception?</p>
  
  <p>Thanks.</p>