Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The problem is probably your event source. You have to create an event source before you can write to the event log (if you don't, the Event log object tries to create one for you "automagically" the first time you write to the log).</p> <p>You have to have hightened permissions to create an event log source. In some of my web apps, I have put the code to create the event source into my setup (setup runs as admin, so I'm always guaranteed to be able to create the source).</p> <p>You just have to create the source once. After that, your ASP.Net app should have sufficient permissions to write entries specifying the source (or sources) that you created.</p> <p>You can use an EventLogInstaller in your setup to create the source, or you could just write a little utility to call EventLog.CreateEventSource() as an admin.</p> <p>I'll show you both ways:</p> <pre> <code> // You would do this one from within an Installer class in a setup: private void InstallEventLog() { EventLogInstaller logInstaller; //Create an instance of an EventLogInstaller. logInstaller = new EventLogInstaller(); //Set the source name of the event log. logInstaller.Source = "TheEventSourceName"; Installers.Add(logInstaller); } </code> </pre> <p>Method 2: just call CreateEventSource once as an admin (you could put the following code into a console app, for example, and run the console app as admin</p> <pre> <code> EventLog.CreateEventSource("TheSourceName", "Application"); </code> </pre> <p>Bonus: If you have Powershell installed on your server, you can do it from the Powershell command prompt: (Make sure you are running Powershell as an admin)</p> <pre> <code> [system.Diagnostics.EventLog]::CreateEventSource("SourceName", "Application") </code> </pre> <p>Hop that helps</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload