System.Security.SecurityException Writing to the Application Event Log on Windows Server 2008 with ASP.NET 4.0

I worked with a customer recently who ran into an error with one of our products on Windows Server 2008.   It was a System.Security.SecurityException Writing to the Application Event Log on Windows Server 2008 with ASP.NET 4.0.  We tracked the source of the error to a permissions issue with the Security event log key in the Windows Registry. Interesting problem since we use the exact same code to write to the Application event log in our other solutions. However, it appears this issue is related to the .NET 4.0 framework and wasn’t an issue in .NET 2.0/3.0/3.5.

The fix is very straightforward: Allow Read permissions in the Windows registry to the identity running the application. In our case, we’re dealing with a web application so we had to add the application pool identity (NETWORK SERVICE) with Read permissions to the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesEventLogSecurity key. This allowed the proper access and everything fell into place.

System.Security.SecurityException Writing to the Application Event Log

http://stackoverflow.com/questions/1274018/system-security-securityexception-when-writing-to-event-log

Comments are closed.

Sign in
classic
Forgot password?
×
Sign up

(*) Required fields

I agree with OptimaSales Terms & Privacy Policy

×