Tuesday, March 13, 2007

I was playing around with Exception Handling Application Block ( EHAB) !

I created a dummy ASP.Net Web Application.

I added the Reference of EHAB to the Project.

I build the project, i got an error saying

"type IExceptionPublisher is not defined "

I build the EHAB and added its reference again.

Now, i build the project and the error was gone.

Now, i wrote a code that would rise an exception and i wanted that to be recorded using EHAB.

I ran the project and i got an un expected exception saying

"Requested registry access is not allowed"

I googled this exception and found some info about

Thanks to Mr. Brono from UK..

This is what he had posted in his blog...

Requested Registry Access is not allowed
SOLUTION IS AS FOLLOW (THIS SOLUTION IS FOR DEVELOPMENT ENVIRONMENT ONLY):

1. Give the ASPNET user permission to read the Security eventlog registry entry.Run regedt32 Navigate to the following key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the ASPNET user Give it Read permission

2. Change settings in machine.config fileRun ExplorerNavigate to WINDOWS or WINNT folderOpen Microsoft.NET folderOpen Framework folderOpen v1.1.4322 folder (folder name may be different, depending on what dotnet version is installed)Open CONFIG folderOpen machine.config file using notepad (make a backup of this file first)Locate processmodel tag (approx. at line 441)Locate userName="machine" (approx. at line 452)Change it to userName="SYSTEM"Save and close the fileClose Explorer

3. Restart IIS Run IISReset

Production Solution

Go to the application pool and select IDENTITY leave it Network ServiceGo to the registry it is accessing and select the permissionAdd the NETWORK SERVICE user to it


After making the above changes... I ran the project again and found one more exception sayin...

"Event Log Full"
I had to make the event log empty... Googled again.

Run the command "eventvwr.msc" from Windows Start

Right Click on the Application and say clear all events.

Now the event log was empty.

I ran the application again and found the exception Published in the event log.

More to come on EHAB.

0 comments: