Question

When I debug my website its all fine.

But when I publish it shows tracing information, but I never enabled it!

I try adding the following to my web.config:

<trace enabled="false" localOnly="true"> </trace>

But it still displays the Tracing info.

Était-ce utile?

La solution

<trace enabled="true" localOnly="true"/>

For tracing to work it has to be enabled and for it to work only on debug mode the localOnly attribute should be set to 'true'

If you want to set additional parameters.

<trace enabled="true" pageOutput="true" requestLimit="4000" traceMode="SortByCategory" writeToDiagnosticsTrace="true" localOnly="true"/>

pageOutput attribute lets you see the output at the bottom of the page.

For more information visit https://msdn.microsoft.com/en-gb/library/6915t83k(v=vs.85).aspx

And how to use it in the code

#If DEBUG Then
  CType(HttpContext.Current.Handler, Page).Trace.Write("Test - Cache       
 hit")
#End If
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top