Configuration Error on initializeData="<app root directory>\Asptesttrace.log" />
I am following the Walkthrough: Integrating ASP.NET Tracing with System.Diagnostics Tracing document and when I get the section on Routing All Tracing Output to .NET Framework Tracing it said to add the following the to the trace section in the web.config
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="<app root directory>\Asptesttrace.log" />
The initializeData="<app root directory>\Asptesttrace.log" />
part is giving a compile error.
In visual studio the it said the app root and directory part need tags.
When run the default.aspx page there error shown in the webpae is
Server Error in '/' Application.
Configuration Error Description: An error开发者_运维问答 occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: '<', hexadecimal value 0x3C, is an invalid attribute character. Line 25, position 27.
Source Error:
Line 23: <add name="TestTracer"
Line 24: type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
Line 25: initializeData="<app root directory>\Asptesttrace.log" />
Line 26: </listeners>
Line 27: </trace>
Of I am stumped what is wrong?
Can you see that you have break the xml format ? You can not add this
<app root directory>
inside the the tag, you break the xml format.
Remove the and if you have permission to write, its going to work
<add name="TestTracer"
type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
initializeData="Asptesttrace.log" />
Reference: http://msdn.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener.aspx
<app root directory>
: this is the part that you need to change by hand, and type your application root path, if that was visual studio says, but its not a parameter that find its. Eg: c:\inetpub\vhost\yoursite.com\httpfiles\Asptesttrace.log
精彩评论