How do I enable my ASP.NET application to write to new event source?

From Guidance Share

Jump to: navigation, search

J.D. Meier, Prashant Bansode, Alex Mackman


To enable your ASP.NET application to write to the event log using its own event source, you have two options:

  • Grant your ASP.NET process account (or impersonated identity if your application uses impersonation) permissions on the following registry key: HKLM\SYSTEM\CurrentControlSet\Services\Eventlog\.
  • To avoid editing the registry, if administrator privileges are available at installation time, create the event source at application install time. You can use a .NET installer class, which can be instantiated by the Windows Installer (if you are using .msi deployment) or by the InstallUtil.exe system utility.

The default ASP.NET worker process identities have sufficient permissions to write records to the event log using existing event sources. However, if your application needs to create new event sources using the default worker process identity, it would fail as the default worker process identity does not have privileges to create event sources. In a production scenario where you might be using, custom domain account for running the ASP.Net application instead of the default. The permissions on the registry must be granted to the custom domain account. If you have configured your application to use impersonation, then permissions must be granted to the authenticated user's account or IUSR_machineName for anonymous callers.

More Information

For more information to configure an event source in the event log for the account running ASP.NET, see;en-us;329291

Personal tools