Exception Management AB Issue in ASP.NET

G

Guest

I'm trying to use the "Exception Management Application Block" that Microsoft supplies. I've built and included all the relevant code but I'm hitting a wall. When throwing an exception to be generated in the event log in XML I get the following error on line 515:

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

Source Error:


Line 513: Private Sub VerifyValidSource()
Line 514: Try
Line 515: If Not EventLog.SourceExists(applicationName) Then
Line 516: EventLog.CreateEventSource(applicationName, logName)
Line 517: End If


In order to try to resolve this I've added the ASPNET account in to the Administrators group and made permisson changes to the registry EventLog hive but no joy. Microsoft's documentation suggests that this was an issue in the beta version of their code but not in the release version.

http://msdn.microsoft.com/library/en-us/dnbda/html/emab-rm.asp?frame=true&_r=1

Has anyone solved this issue or can offer assistance that would be great.

Thanks

Damon
 
H

Hans Kesting

damon.f said:
I'm trying to use the "Exception Management Application Block" that
Microsoft supplies. I've built and included all the relevant code but I'm
hitting a wall. When throwing an exception to be generated in the event log
in XML I get the following error on line 515:
System.Security.SecurityException: Requested registry access is not allowed.

Source Error:


Line 513: Private Sub VerifyValidSource()
Line 514: Try
Line 515: If Not EventLog.SourceExists(applicationName) Then
Line 516: EventLog.CreateEventSource(applicationName, logName)
Line 517: End If


In order to try to resolve this I've added the ASPNET account in to the
Administrators group and made permisson changes to the registry EventLog
hive but no joy. Microsoft's documentation suggests that this was an issue
in the beta version of their code but not in the release version.
http://msdn.microsoft.com/library/en-us/dnbda/html/emab-rm.asp?frame=true&_r=1

Has anyone solved this issue or can offer assistance that would be great.

Thanks

Damon

I've had that problem also. You need to "install" this block (on the
development machine(s)
and the server(s) where you deploy the app):
* start the "Visual Studio Command Prompt"
* go to the directory containing (some copy of) the dll's of this block
* execute " InstallUtil Microsoft.ApplicationBlocks.ExceptionManagement.dll
"
This will grant this block access to the eventlog.

After that it works perfectly.

Hans Kesting
 
G

Guest

Hans
I have figured out how to use the InstallUtil in conjunction with the ExceptionManagerInstaller component and I am able to publish exceptions. However, MS Exception Block internal exceptions are generated each time I publish my exception. I have attached the Event log output for both of these exceptions.

I modified the name of the Event source in the ExceptionManagerInstaller.cs file before I compiled it. It is called : CoolbluePublishedException. The installer runs fine and creates EventSource entries in the registry HKLM_SYSTEM_CurrentControlSet_Services_EventLog_Application for both CoolbluePublishedException and ExceptionManagerInternalException (the default)

As you can see, this works, but I don't want the overhead of a meaningless exception thrown every time. Is there a specific right I need to grant to the ASP.NET user to avoid this? I wish the documentation would state the explicit rights needed. Anyway, thanks for any help you or anyone else can provide

Keit

Event Type: Erro
Event Source: ExceptionManagerInternalExceptio
Event Category: Non
Event ID:
Date: 3/19/200
Time: 2:42:11 P
User: N/
Computer: MYMACHIN
Description

1) Exception Informatio
********************************************
Exception Type: Microsoft.ApplicationBlocks.ExceptionManagement.CustomPublisherExceptio
PublisherFormat: Exceptio
PublisherAssemblyName: Microsoft.ApplicationBlocks.ExceptionManagemen
PublisherTypeName: Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublishe
MachineName: MYMACHIN
CreatedDateTime: 3/19/2004 2:42:11 P
AppDomainName: /LM/W3SVC/1/Root/Coolblue-2-12724206473382812
ThreadIdentityName:
WindowsIdentityName: MYDOMAIN\MyUse
AdditionalInformation
logname: Coolblu
applicationname: ExceptionManagerPublishedExceptio
Message: Custom Publisher failed to execute
TargetSite: Void PublishToCustomPublisher(System.Exception, System.Collections.Specialized.NameValueCollection, Microsoft.ApplicationBlocks.ExceptionManagement.PublisherSettings
HelpLink: NUL
Source: Microsoft.ApplicationBlocks.ExceptionManagemen

StackTrace Informatio
********************************************
at Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.PublishToCustomPublisher(Exception exception, NameValueCollection additionalInfo, PublisherSettings publisher) in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 27
at Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.Publish(Exception exception, NameValueCollection additionalInfo) in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 20

2) Exception Informatio
********************************************
Exception Type: System.Security.SecurityExceptio
PermissionType: NUL
PermissionState: NUL
GrantedSet: NUL
RefusedSet: NUL
Message: The event source ExceptionManagerPublishedException does not exist and cannot be created with the current permissions
TargetSite: Void VerifyValidSource(
HelpLink: NUL
Source: Microsoft.ApplicationBlocks.ExceptionManagemen

StackTrace Informatio
********************************************
at Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 66
at Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.Publish(Exception exception, NameValueCollection additionalInfo, NameValueCollection configSettings) in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 53
at Microsoft.ApplicationBlocks.ExceptionManagement.ExceptionManager.PublishToCustomPublisher(Exception exception, NameValueCollection additionalInfo, PublisherSettings publisher) in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 26

3) Exception Informatio
********************************************
Exception Type: System.Security.SecurityExceptio
PermissionType: NUL
PermissionState: NUL
GrantedSet: NUL
RefusedSet: NUL
Message: Requested registry access is not allowed.
TargetSite: Microsoft.Win32.RegistryKey OpenSubKey(System.String, Boolean)
HelpLink: NULL
Source: mscorlib

StackTrace Information
*********************************************
at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName, Boolean useMutex)
at System.Diagnostics.EventLog.CreateEventSource(String source, String logName, String machineName)
at System.Diagnostics.EventLog.CreateEventSource(String source, String logName)
at Microsoft.ApplicationBlocks.ExceptionManagement.DefaultPublisher.VerifyValidSource() in e:\coolblue\microsoft.applicationblocks.exceptionmanagement\exceptionmanager.cs:line 661



Exception I am publishing:

Event Type: Error
Event Source: CoolbluePublishedException
Event Category: None
Event ID: 0
Date: 3/19/2004
Time: 2:42:11 PM
User: N/A
Computer: MYMACHINE
Description:

General Information
*********************************************
Additional Info:
ExceptionManager.MachineName: MYMACHINE
ExceptionManager.TimeStamp: 3/19/2004 2:42:11 PM
ExceptionManager.FullName: Microsoft.ApplicationBlocks.ExceptionManagement, Version=1.0.1539.19301, Culture=neutral, PublicKeyToken=null
ExceptionManager.AppDomainName: /LM/W3SVC/1/Root/Coolblue-2-127242064733828125
ExceptionManager.ThreadIdentity:
ExceptionManager.WindowsIdentity: MYDOMAIN\MyUser

1) Exception Information
*********************************************
Exception Type: System.Web.HttpUnhandledException
ErrorCode: -2147467259
Message: Exception of type System.Web.HttpUnhandledException was thrown.
TargetSite: Boolean HandleError(System.Exception)
HelpLink: NULL
Source: System.Web

StackTrace Information
*********************************************
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

2) Exception Information
*********************************************
Exception Type: Coolblue.Common.Exceptions.DBAccessException
PublisherAssemblyName: NULL
OSVersion: Microsoft Windows NT 5.0.2195.0
MachineName: MYMACHINE
CreatedDateTime: 3/19/2004 2:42:11 PM
AppDomainName: /LM/W3SVC/1/Root/Coolblue-2-127242064733828125
ThreadIdentityName:
WindowsIdentityName: MYDOMAIN\MyUser
AdditionalInformation:
Coolblue Randy Configs 1: Some settings to help troubleshoot
Coolblue Sandy Configs 2: Some more settings to help troubleshoot
Message: SqlError Occurred
TargetSite: Void btnThrowEx_Click(System.Object, System.EventArgs)
HelpLink: NULL
Source: WebUI

StackTrace Information
*********************************************
at Coolblue.WebUI.Logon.btnThrowEx_Click(Object sender, EventArgs e) in e:\coolblue\webui\logon.aspx.cs:line 74
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain()

3) Exception Information
*********************************************
Exception Type: System.Data.SqlClient.SqlException
Errors: System.Data.SqlClient.SqlErrorCollection
Class: 11
LineNumber: 0
Message: Cannot open database requested in login 'MyLocalDB'. Login fails.
Login failed for user 'MYDOMAIN\MyUser'.
Number: 4060
Procedure:
Server:
State: 1
Source: .Net SqlClient Data Provider
TargetSite: Void OpenAndLogin()
HelpLink: NULL

StackTrace Information
*********************************************
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, SqlConnectionString connectionOptions)
at System.Data.SqlClient.SqlConnection.Open()
at Coolblue.WebUI.Logon.btnThrowEx_Click(Object sender, EventArgs e) in e:\coolblue\webui\logon.aspx.cs:line 69


----- Hans Kesting wrote: -----


damon.f said:
I'm trying to use the "Exception Management Application Block" that
Microsoft supplies. I've built and included all the relevant code but I'm
hitting a wall. When throwing an exception to be generated in the event log
in XML I get the following error on line 515:
Line 514: Try
Line 515: If Not EventLog.SourceExists(applicationName) Then
Line 516: EventLog.CreateEventSource(applicationName, logName)
Line 517: End If
Administrators group and made permisson changes to the registry EventLog
hive but no joy. Microsoft's documentation suggests that this was an issue
in the beta version of their code but not in the release version.
I've had that problem also. You need to "install" this block (on the
development machine(s)
and the server(s) where you deploy the app):
* start the "Visual Studio Command Prompt"
* go to the directory containing (some copy of) the dll's of this block
* execute " InstallUtil Microsoft.ApplicationBlocks.ExceptionManagement.dll
"
This will grant this block access to the eventlog.

After that it works perfectly.

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top