locked
IIS 500 Error WCF Service and Failed Request Tracing not info RRS feed

  • Question

  • User-1539944240 posted

    I have a WCF service running in IIS 8.5 on Windows Server 2012 R2 with AppPool Integrated.

    I open url in the server: http://localhost:50123/MyService.svc

    I have **HTTP 500 Internal Server Error**. (IExplorer cannot show the page)

    I have not found the problem in Event logs, IIS Logs.

    I apply this steps: https://peter.hahndorf.eu/blog/iislogging.html

    Disable IE “Friendly HTTP error messages”

    <customErrors mode=”Off” />

    <httpErrors errorMode="Detailed" />

    <serviceMetadata httpGetEnabled="true"/>
    <serviceDebug includeExceptionDetailInFaults="true"/>

    I use WCF tracing, but not view the error messsage.

    I setup "**Failed Request Tracing**", for All content, verbose error logging, HTTP errors in range 400-600.

    I open fr000001.xml file from *%systemdrive%\inetpub\logs\FailedReqLogFiles\W3SVC1*

    I only view **MODULE_SET_RESPONSE_ERROR_STATUS Warning:**


    > ModuleName ManagedPipelineHandler
    > Notification 128
    > HttpStatus 500
    > HttpReason Internal Server Error
    > HttpSubStatus 0
    > ErrorCode 0
    > ConfigExceptionInfo
    > Notification EXECUTE_REQUEST_HANDLER
    > ErrorCode The operation completed successfully. (0x0)

    Error 500:

    > HttpStatus 500
    > HttpReason Internal Server Error

    and successfully ?

    > ErrorCode The operation completed successfully. (0x0)

    **Not more info about the error.**


    About the error:

    I have and WCF Inspector with IDispatchMessageInspector

    Like https://patrickdesjardins.com/blog/wcf-inspector-for-logging


    The error is about attribute `logFileName="c:\log.txt"`

    **If the path exists, all is OK.
    If the path NOT exists, I get Http 500 Error.**


    <extensions>
    <behaviorExtensions>
    <add name="myLogBehavior"
    type="MyServiceA.LogFileBehaviorExtensionElement, MyServiceA" />
    </behaviorExtensions>
    </extensions>

    <endpointBehaviors>
    <behavior name="behavior1">
    <myLogBehavior logFileName="c:\log.txt" />
    </behavior>
    </endpointBehaviors>

    This means there is an unhanded exception with in the code.

    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 ?

    Sunday, July 8, 2018 11:44 AM

All replies

  • User1120430333 posted

    The 500 error means that the service code through an exception, the exception was unhandled and the Web server swallowed exception and through the 500 error. You need to put a try/catch in the code and log the error, or use a console program to debug the service to see the exception by attaching the debugger to the Web application through VS.

    http://codetunnel.com/how-to-debug-your-aspnet-projects-running-under-iis/

    https://www.codeproject.com/Articles/37182/Debug-your-ASP-NET-Application-while-Hosted-on-IIS

    Sunday, July 8, 2018 2:57 PM
  • User-1539944240 posted

    I use WCF Tracing

    <system.diagnostics>
        <sources>
          <source name="System.ServiceModel" propagateActivity="true" switchValue="All">
            <listeners>
              <add name="xmlTraceListener" />
            </listeners>
          </source>
          <source name="System.ServiceModel.MessageLogging" switchValue="All">
            <listeners>
              <add name="xmlTraceListener" />
            </listeners>
          </source>
          <source name="System.Net">
            <listeners>
              <add name="System.Net" />
            </listeners>
          </source>
          <source name="System.Net.HttpListener">
            <listeners>
              <add name="System.Net" />
            </listeners>
          </source>
          <source name="System.Net.Sockets">
            <listeners>
              <add name="System.Net" />
            </listeners>
          </source>
          <source name="System.Net.Cache">
            <listeners>
              <add name="System.Net" />
            </listeners>
          </source>
        </sources>
        <sharedListeners>
          <add name="xmlTraceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\ServiceWcf.svclog" />
          <add name="System.Net" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Servitelco\Logs\IntegrationLabor\SystemNet.trace.log" traceOutputOptions="DateTime" />
        </sharedListeners>
        <switches>
          <add name="System.Net" value="Verbose" />
          <add name="System.Net.Sockets" value="Verbose" />
          <add name="System.Net.Cache" value="Verbose" />
          <add name="System.Net.HttpListener" value="Verbose" />
        </switches>
      </system.diagnostics>
    
    
     <system.serviceModel>
    
            <diagnostics>
                <messageLogging logEntireMessage="true" logMalformedMessages="true" logMessagesAtServiceLevel="true" logMessagesAtTransportLevel="true" maxSizeOfMessageToLog="26214445" />
            </diagnostics>

    Monday, July 9, 2018 2:18 PM
  • User1120430333 posted

    I use WCF Tracing

    That is not going to expose the .NET exception error that was thrown.

    You need to put a try/catch in the code at a possible place where you think the exception may be occouring and log the exception, like write it out to a text file so that you can see the exemption error message. Or you start coming up with the means to debug the service with a test harness like a console program consuming the WCF service with the console program and the WCF service running in VS's debug mode.

    Other than that, you'll just be stabbing in the dark with no results as to what the exception error is about.

    Monday, July 9, 2018 4:00 PM