Microsoft.ApplicationBlocks. ExceptionManagement The event source x does not exist error

 If you get the following error when using the Microsoft.ApplicationBlocks.ExceptionManagement library:

System.Security.SecurityException: The event source ExceptionManagerInternalException does not exist and cannot be created with the current permissions. ---> System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource)
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData)
at System.Diagnostics.EventLog.CreateEventSource(String source, String logName)
at Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher. VerifyValidSource()

One way of solving this is to install the Microsoft.ApplicationBlocks.ExceptionManagement.dll by running the following in a dos window:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe Microsoft.ApplicationBlocks.ExceptionManagement.dll

If for some reason your server admin doesn’t want to do that then you can just ask them to create the two event sources manually using eventcreate in a dos window:

eventcreate /t error /id 1000 /so ExceptionManagerInternalException /l application /d "new src ExceptionManagerInternalException in application log"
eventcreate /t error /id 1000 /so ExceptionManagerPublishedException /l application /d "new src ExceptionManagerPublishedException in application log"

1 comment: