title: EventLog permission failing in ASP.Net on Win7
body: <p>I have an ASP.Net app .net 3.5 SP1, running in Win7 . During the login process, something within the ASP.Net login control is causing a write to the security log (this sounds acceptable to me) in the event log. The problem is that it seems the app doesn't have permission to do this. There error is:</p>
  
  <p><strong>Description</strong>: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. </p>
  
  <p><strong>Exception</strong> Details: System.Security.SecurityException: Request for the permission of type 'System.Diagnostics.EventLogPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</p>
  
  <p>The stack trace doesn't show a single line of code from my application, its all in the framework.
  The last 5 lines are:
     System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark&amp; stackMark, Boolean isPermSet) +0
     System.Security.CodeAccessPermission.Demand() +61
     System.Diagnostics.EventLog..ctor(String logName, String machineName, String source) +125
     System.Diagnostics.EventLog..ctor() +24
     System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +52</p>
  
  <p>This same app works fine on XP SP2. I've hunted around and can't find how to give permissions. I've tried running hte app pool as LocalSystem and ApplicationPoolIdentity.</p>
  
  <p>Whats the easiest way to get this running? Its my local dev machine and I don't care if I open up security holes, as long as I don't have to modify code (ie I need the solution to be an INETMGR change or web.config or some local permissions, etc).</p>
  
  <p>Thanks! </p>