title: IIS 500 Error WCF Service and Failed Request Tracing not info
body: <p>I have a WCF service running in IIS 8.5 on Windows Server 2012 R2 with AppPool Integrated.</p>
  
  <p>I open url in the server: <a href="http://localhost:50123/MyService.svc" rel="nofollow noreferrer">http://localhost:50123/MyService.svc</a>  </p>
  
  <p>I have <strong>HTTP 500 Internal Server Error</strong>. (IExplorer cannot show the page)</p>
  
  <p>I have not found the problem in Event logs, IIS Logs.</p>
  
  <p>I apply this steps: <a href="https://peter.hahndorf.eu/blog/iislogging.html" rel="nofollow noreferrer">https://peter.hahndorf.eu/blog/iislogging.html</a></p>
  
  <pre><code>Disable IE “Friendly HTTP error messages”
  
  &lt;customErrors mode=”Off” /&gt;
  
  &lt;httpErrors errorMode="Detailed" /&gt;
  
  &lt;serviceMetadata httpGetEnabled="true"/&gt;
  &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
  </code></pre>
  
  <p>I use WCF tracing, but not view the error messsage.</p>
  
  <pre><code>&lt;system.diagnostics&gt;
      &lt;sources&gt;
        &lt;source name="System.ServiceModel" propagateActivity="true" switchValue="All"&gt;
          &lt;listeners&gt;
            &lt;add name="xmlTraceListener" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;source name="System.ServiceModel.MessageLogging" switchValue="All"&gt;
          &lt;listeners&gt;
            &lt;add name="xmlTraceListener" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;source name="System.Net"&gt;
          &lt;listeners&gt;
            &lt;add name="System.Net" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;source name="System.Net.HttpListener"&gt;
          &lt;listeners&gt;
            &lt;add name="System.Net" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;source name="System.Net.Sockets"&gt;
          &lt;listeners&gt;
            &lt;add name="System.Net" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
        &lt;source name="System.Net.Cache"&gt;
          &lt;listeners&gt;
            &lt;add name="System.Net" /&gt;
          &lt;/listeners&gt;
        &lt;/source&gt;
      &lt;/sources&gt;
      &lt;sharedListeners&gt;
        &lt;add name="xmlTraceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\ServiceWcf.svclog" /&gt;
        &lt;add name="System.Net" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\SystemNet.trace.log" traceOutputOptions="DateTime" /&gt;
      &lt;/sharedListeners&gt;
      &lt;switches&gt;
        &lt;add name="System.Net" value="Verbose" /&gt;
        &lt;add name="System.Net.Sockets" value="Verbose" /&gt;
        &lt;add name="System.Net.Cache" value="Verbose" /&gt;
        &lt;add name="System.Net.HttpListener" value="Verbose" /&gt;
      &lt;/switches&gt;
    &lt;/system.diagnostics&gt;
  
  
   &lt;system.serviceModel&gt;
  
          &lt;diagnostics&gt;
              &lt;messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="26214445" /&gt;
          &lt;/diagnostics&gt;
  </code></pre>
  
  <p>I setup "<strong>Failed Request Tracing</strong>", for All content, verbose error logging, HTTP errors in range 400-600. </p>
  
  <p>I open fr000001.xml file from   <em>%systemdrive%\inetpub\logs\FailedReqLogFiles\W3SVC1</em></p>
  
  <p>I only view  <strong>MODULE_SET_RESPONSE_ERROR_STATUS Warning:</strong></p>
  
  <blockquote>
    <p>ModuleName ManagedPipelineHandler<br>
    Notification 128<br>
    HttpStatus 500<br>
    HttpReason Internal Server Error<br>
    HttpSubStatus 0 
    ErrorCode 0<br>
    ConfigExceptionInfo<br>
    Notification EXECUTE_REQUEST_HANDLER<br>
    ErrorCode The operation completed successfully. (0x0)  </p>
  </blockquote>
  
  <p>Error 500:</p>
  
  <blockquote>
    <p>HttpStatus 500<br>
    HttpReason Internal Server Error  </p>
  </blockquote>
  
  <p>and successfully ?</p>
  
  <blockquote>
    <p>ErrorCode The operation completed successfully. (0x0) </p>
  </blockquote>
  
  <p><strong>Not more info about the error.</strong></p>
  
  <p>About the error:</p>
  
  <p>I have and WCF Inspector with IDispatchMessageInspector</p>
  
  <p>Like <a href="https://patrickdesjardins.com/blog/wcf-inspector-for-logging" rel="nofollow noreferrer">https://patrickdesjardins.com/blog/wcf-inspector-for-logging</a></p>
  
  <p>The error is about attribute <code>logFileName="c:\log.txt"</code> </p>
  
  <p><strong>If the path exists, all is OK.
  If the path NOT exists, I get Http 500 Error.</strong></p>
  
  <pre><code> &lt;extensions&gt;
              &lt;behaviorExtensions&gt;
                  &lt;add name="myLogBehavior"
                       type="MyServiceA.LogFileBehaviorExtensionElement, MyServiceA" /&gt;
              &lt;/behaviorExtensions&gt;
          &lt;/extensions&gt;
  
  
    &lt;serviceBehaviors&gt;
      &lt;behavior&gt;
        &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /&gt;
        &lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;
        &lt;MyLogFileBehavior logFileName="C:\Servitelco\Logsxxx\IntegrationLabor\log.txt" /&gt;
      &lt;/behavior&gt;
    &lt;/serviceBehaviors&gt;
  
  &lt;endpointBehaviors&gt;
            &lt;behavior name="behavior1"&gt;
                &lt;myLogBehavior logFileName="c:\log.txt" /&gt;
            &lt;/behavior&gt;
        &lt;/endpointBehaviors&gt;
  </code></pre>
  
  <p>This means there is an unhanded exception with in the code.</p>
  
  <p>Event viewer, IIS Logs, WCF tracing, Failed Request Tracing not shown the error message, why? How get the full error message ? OS not logging the  error in anyway ?</p>