ASPNET Event Log Access
From: Charles Leonard (elmsdn13_at_hotmail.com)
Date: 08/27/03
- Next message: Darren Mombourquette: "Re: Enterprise Policy URL Condition"
- Previous message: Keith Patrick: "Re: Meaning/consequences of Unrestricted=true"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 27 Aug 2003 08:14:17 -0700
>From what I have read, finding a convenient way to access
and write to the Application Event Log from within a Web
Service application is a common, frustrating problem. I'm
not quite sure why this was made so difficult for
something that seems so harmless, necessary and is the
common logging standard.
Here's what I have tried:
*Add the ASPNET user to the Application Event Log
security with "Full Control" in the Registry (using
regedt32).
The above suggestion works only if the Application Log
source (i.e. the name of the application) preexists in the
Registry. Below is an excerpt of the code I am using to
access/write to the Application Event Log within my Web
Service:
objEventLog = new System.Diagnostics.EventLog();
if (!System.Diagnostics.EventLog.SourceExists
(strProgName))
System.Diagnostics.EventLog.CreateEventSource(
"MyProg", "Application");
objEventLog.Source = strProgName;
objEventLog.WriteEntry(strData,
System.Diagnostics.EventLogEntryType.Error);
The above code works great in a non-web application. But,
it will not work within my Web Service unless the "MyProg"
source pre-exists in the Registry (along with the proper
ASPNET permissions established). Of course I can
accomplish the source creation by running the code outside
the Web Service in the non-web application to create my
log source.
However, this circumstance is not ideal when you consider
deployment into a production environment. That leaves two
things I can do in the installation process: 1) Run the
non-web application during the installation process to
create the log source 2) deliver registry settings to
create the log source within the Application Log.
My complaint is that this is a lot of trouble to do
something that seems innocuous. Logging to the
Application Event log is a very useful tool and something
administrators have come to expect from Windows programs.
Furthermore, since I have told the Registry that ASPNET
has "Full Control" (write access, etc.) one would think
that should be enough to let the above code work without
having to do anything extra (i.e. I should not have to
manually figure out how I can create a log source-the
above code should just work).
Does anyone know of any other tricks to allow the above
code to work within a Web Service that is simple and does
not involve impersonation? Also, does anyone know if
Microsoft has any plans to address this issue in a future
version of Visual Studio .NET?
Thanks.
--Charles Leonard
- Next message: Darren Mombourquette: "Re: Enterprise Policy URL Condition"
- Previous message: Keith Patrick: "Re: Meaning/consequences of Unrestricted=true"
- Next in thread: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Reply: Joe Kaplan \(MVP - ADSI\): "Re: ASPNET Event Log Access"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|