title: Why ASP.NET website customErrors mode="Off" not working
body: <p>Our ASP.NET 4.0 web application on production server (Windows Server 2008 R2 64bit with IIS7.5) is not showing detailed error message despite adding the following settings in the web.config file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
          &lt;customErrors mode="Off"/&gt;
      &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>According to this <a href="https://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.100).aspx" rel="nofollow">MSDN article</a>, we should get the detailed error message but we are getting the following custom error message that's displayed on an error page that we direct to in the "<code>catch</code>" block of <code>try/catch</code> when an error occurs:</p>
  
  <blockquote>
    <p>Application has encounter an error, please try again later. If the problem persists please contact the system admin at: ....."</p>
  </blockquote>
  
  <p>We also tried <a href="http://chuchuva.com/pavel/2010/08/how-to-enable-detailed-error-information-for-iis-and-asp-net/" rel="nofollow">this suggestion</a> but still on an error on the <code>try/catch</code> block the above message gets displayed. We even restarted the IIS to make sure the web.config changes get applied but not luck. We have made sure the above settings are not repeated in the web.config file and that there are no other web.config files in the app.</p>
  
  <p><strong>Edit</strong>
  Moreover, we do not have <code>&lt;deployment ...&gt;</code> element in the machine.config file that means according to this <a href="https://msdn.microsoft.com/en-us/library/vstudio/ms228298%28v=vs.100%29.aspx" rel="nofollow">MSDN article</a>, <code>&lt;deployment retail="false"</code>> is the default.</p>