views:

255

answers:

1

I have a WCF service hosted as a Windows Service. The server hosting it is running IIS6.

Every so often clients report a 503 Service Unavailable error. I can't see any problems on the server side: I can see the logging I expect from the service itself, there are no entries in the Application or System event logs.

The clients retry and will normally succeed, so apart from suggesting to the developers responsible for the client app that they automatically re-attempt when their code receives a 503 error, is there an easy way for my process to monitor IIS and be informed that its response caused an error?

So I'm after one of a number of things:

  1. Can I have the WCF process call into IIS to get the status code?
  2. Can I get the IIS service to report the 503 error in an event log (or with a callback function) for the WCF process to be informed somehow?
  3. Should I just get the client code to handle the situation, retries are generally successful, after all.
+1  A: 

When you host a WCF service as a Windows Service you no longer rely on IIS. The only common part I guess is the protocol stack HTTP.SYS. I would suggest you activating logging into the service configuration file which will give you extensive information:

<system.diagnostics>
    <trace autoflush="true" />
    <sources>
        <source name="System.ServiceModel" 
                switchValue="Information, ActivityTracing"
                propagateActivity="true">
            <listeners>
               <add name="sdt" 
                    type="System.Diagnostics.XmlWriterTraceListener" 
                    initializeData= "WcfDetailTrace.svclog" />
            </listeners>
        </source>
    </sources>
</system.diagnostics>

and then use SvcTraceViewer.exe to analyze the resulting log data.

Darin Dimitrov