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.

有帮助吗?

解决方案

<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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top