4

I have a custom handler like this,

public class Handler : IHttpHandler
{

    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";
        context.Response.Write("Hello World");
    }

    public bool IsReusable
    {
        get
        {
            return false;
        }
    }
}

Why does this not work?

<system.diagnostics>
  <sources>
    <source name="System.Web" switchValue="All" propagateActivity="true">
      <listeners>
        <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\logs\Traces_Documents.svclog" />
      </listeners>
    </source>
  </sources>
</system.diagnostics>

When that is in the web.config it does nothing when I call the handler. No logging etc.

I have previously used the same trace listener on the System.ServiceModel namespace with a WCF service, and that worked.

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
peter
  • 13,009
  • 22
  • 82
  • 142

1 Answers1

3

Do you have tracing enabled?

<system.web>
    <trace enabled="true" writeToDiagnosticsTrace="true" />
</system.web>

Also, what version of the framework / IIS are you using?

See the DnrTV episode w/ Steve Smith which has good information on Asp.Net Tracing.

Jason
  • 4,897
  • 2
  • 33
  • 40