Event Log: Access Denied, Permission

S

Sachin

Hi All,

I am trying to create and write to Event Log on Windows Server 2003 system
in a simple C# application.

However, it throws the exception saying that Access is denied.

What permission and settings are required for creating and writing the event
logs on the system.

Any help or pointer.

Thanks in advance
Sachin
 
T

Tom Porterfield

I am trying to create and write to Event Log on Windows Server 2003 system
in a simple C# application.

However, it throws the exception saying that Access is denied.

What permission and settings are required for creating and writing the event
logs on the system.

Any help or pointer.

Typically you can write to the event log with no problems, but you need to
use an existing log file and existing event sources unless you run under
high privileges.

One option, if you want your own log or sources, is to create an installer
that would be run be an admin on the machine to create your log and
sources. Then your app can write to them under its restricted privileges.

Info on creating an installer and then using installutil.exe can be found
in the following articles:

EventLogInstaller Class
http://msdn.microsoft.com/library/e...temdiagnosticseventloginstallerclasstopic.asp

Installer Tool (Installutil.exe)
http://msdn.microsoft.com/library/en-us/cptools/html/cpconinstallerutilityinstallutilexe.asp
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

Can you post the code in question, where you create the EventLog object and
initialize it?

I have never had any problem with the event log, though

cheers,
 
M

Mohamed El Ashmawy

Does the user that the application run under have permissions on the
machine?
Is it a guest user?
You could set the permissions you need directly on the event files at
%SystemRoot%\system32\config\<LogName>
and set the permissions on the registery keys at
HKLM/System/CurrentControlSet/Services/EventLog

Regards
Mohamed El Ashmawy
MEA Developer Support Center
ITWorx on behalf of Microsoft EMEA GTSC
 
S

Sachin

The code is:

EventLog log = new EventLog();
log.Source = "MySource";
log.WriteEntry(...);
------------------------------------

I even tried impersonation but still same error that access is denied.

Does it require any setting on Activey Directory as user is authenticated
againt the active directory
and os is Windows Server 2003.

TIA
Sachin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top