growled on Thursday, July 13, 2006 7:40:30 AM (Pacific Standard Time, UTC-08:00)
barked at code [.net]

About a month ago I flattened and rebuilt the OS on my primary PC at work [the one I use for development]. Things were starting to act a bit odd and I like to do this every once in awhile anyway to keep things fresh. Yesterday I found myself needing to do some web UI work on our application for the first time since rebuilding my box. I loaded up and built the solution in Visual Studio [of course, after resolving some issues with missing references :-S]. I got this error when loading the local page in IE7:

Description: 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.

Exception Details: System.Security.SecurityException: Requested registry access is not allowed.

Security Exception

In January, I described how to enable event logging for an ASP.NET application on a Windows 2003 server using IIS6. This was my first thought, but then it occurred to me that I'm running Windows XP SP2 with IIS5. Hmm. Something else was bumping around in the back of my head, but I couldn't quite put my finger on it so I did what I always do in that case...turned to mi compadre and asked. :-) Luckily, she remembered running into this problem several months ago and it's a very simple reason and fix.

According to KB article # 329291, this error message occurs when an ASP.NET application tries to write a new event source in the EventLog. So the quick fix is to create the new event source in the registry under the key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application. You can also do this programmatically using the EventLogInstaller class. The detailed instructions for both methods are available in the KB article.

Update (7.19.2006): Reduced the size of the picture as it was overlapping with the sidebar and just looked ugly. Click on it to see the full size image. :-)

~tod

Comments are closed.