title: How to disable ASP.NET request validation for WCF service?
body: <p>I have a .NET 4 WCF service running as an IIS website with ASP.NET compatibility mode. Once of the service methods accepts a string parameter and when there is a value which contains a '&amp;' the ASP.NET pipeline raises a validation exception. I've assigned the following config settings:</p>
  
  <pre><code>&lt;system.web&gt;
    &lt;httpRuntime requestValidationMode="2.0"/&gt;
    &lt;pages validateRequest="false"/&gt;
  &lt;/system.web&gt;
  </code></pre>
  
  <p>And the error persists. The error occurs regardless of whether the input is encoded. I found a potential solution <a href="http://blogs.5dlabs.it/post/2011/03/19/ASPNET-40-2b-WCF-Rest-Services-and-the-request-validation-problem.aspx" rel="nofollow noreferrer">here</a> which suggests providing a custom implementation of System.Web.Util.RequestValidator, however I was wondering whether there are alternatives that can be done with configuration settings only.</p>
  
  <p><strong>EDIT:</strong>
  I've also found <a href="https://stackoverflow.com/questions/287065/canceling-request-validation-using-httphandler-on-iis-7">this</a>, however the proposed solution does not fix the problem.</p>