Registry access error in ApplicationBlocks.ExceptionManagement when using Custom Publisher
I am trying to write and use a custom publisher that will write the errors to a text file. I have deployed it and tested it , it runs fine on my machine. My web.config settings are as follows:
<configSections>
<section name="exceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManagerSectionHandler,Microsoft.ApplicationBlocks.ExceptionManagement" />
</configSections>
<exceptionManagement>
<publisher mode="on" assembly="CustomExceptionManager" type="CustomExceptionManager.CustomPublisher" fileName="E:\Logs\EIS\ExceptionLog.txt" />
<publisher mode="off" assembly="Microsoft.ApplicationBlocks.ExceptionManagement" type="Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher" logName="AdiWeb" applicationName="EIS" />
</exceptionManagement>
Whenever an error occurs in my code, error get logged to the txt file specified.
But when i deploy this code to a server, i get the following error. Why is it even trying to go to EventLog? i am not writing anything there.
Any pointers would be very helpful! Note: My server in a Windows 2003 machine , appln is running on .Net 2.0
Regards,
Lopa
Security Exception
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.
Stack Trace:
[SecurityException: Requested registry access is not allowed.]
System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) +48
Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable) +2752377
System.Diagnostics.EventLog.CreateEventSource(EventSourceCreationData sourceData) +360
System.Diagnostics.EventLog.VerifyAndCreateSource(String sourceName, String currentMachineName) +212
System.Diagnostics.EventLog.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +211
System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) +80
System.Diagnostics.EventLog.WriteEntry(String source, String message, EventLogEntryType type) +14
Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.WriteToLog(String entry, EventLogEntryType type) +37
Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.Publish(Exception exception, NameValueCollection additionalInfo, NameValueCollection configSettings) +1606
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.PublishInternalException(Exception exception, NameValueCollection additionalInfo) +74
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(Exception exception, NameValueCollection additionalInfo) +932
Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(Exception exception) +27
EIS.EISReporting_Category_Menu.Page_Load(Object sender, EventArgs e) +2574
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6978
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +213
System.Web.UI.Page.ProcessRequest() +86
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +18
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.eisreporting_category_menu_aspx.ProcessRequest(HttpContext context) +29
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +303
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64


