Hi,
I am having a problem with getting My.Log.WriteExc eption to write to the
Event Log in ASP.Net 2.0 with a web service.
When an error occurs, My.Log.WriteExc eption doesn't log anything to the
Event Log. Played around with it and ended up adding the following listeners
to catch and write to the event log by adding the following code in the
web.config:
<system.diagnos tics>
<sources>
<!-- This section defines the logging configuration for
My.Application. Log -->
<source name="DefaultSo urce" switchName="Def aultSwitch">
<listeners>
<add name="FileLog"/>
<!-- Uncomment the below section to write to the Application Event
Log -->
<add name="EventLog"/>
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSw itch" value="Informat ion" />
</switches>
<sharedListener s>
<add name="FileLog"
type="Microsoft .VisualBasic.Lo gging.FileLogTr aceListener,
Microsoft.Visua lBasic, Version=8.0.0.0 , Culture=neutral ,
PublicKeyToken= b03f5f7f11d50a3 a, processorArchit ecture=MSIL"
initializeData= "FileLogWri ter"/>
<!-- Uncomment the below section and replace APPLICATION_NAM E with the
name of your application to write to the Application Event Log -->
<add name="EventLog" type="System.Di agnostics.Event LogTraceListene r,
System, Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9"
initializeData= "My Web Service"/>
</sharedListeners >
</system.diagnost ics>
Now My.Log.WriteExc eption will work on my dev machine and write to the event
log. But when I deploy to the web server and an error occurs, it doesn't log
the error and it passes back the following error to me:
Server was unable to process request. ---> Exception has been thrown by the
target of an invocation. ---> Could not create
Microsoft.Visua lBasic.Logging. FileLogTraceLis tener, Microsoft.Visua lBasic,
Version=8.0.0.0 , Culture=neutral , PublicKeyToken= b03f5f7f11d50a3 a,
processorArchit ecture=MSIL. ---> Access to the path 'C:\Documents and
Settings\Defaul t User.WINDOWS\Ap plication Data\Microsoft Corporation\Int ernet
Information Services\6.0.37 90.1830' is denied.
TextFile_Module .CreateTextFile - path and text file
For more information, see Help and Support Center at
http://go.microsoft.com/fwlink/events.asp.
I am running XP PRO x64, VS 2005 Final release, Latest .Net Framework 2.0.
The server is running Win 2003, IIS 6.0, and latest .Net 2.0 Framework.
Thanks for the help,
Tom Wingert