Friday, March 23, 2007
Wednesday, March 14, 2007
EHAB Continued....
Whole day was working on EHAB and finally implemented a custom publisher !
Create the Custom Publisher Class
1) In the Exception Application block, i added a VB class called "CustomPublisher"
2) Code for the class file would go like this...
Imports Microsoft.ApplicationBlocks.ExceptionManagement
Imports Microsoft.ApplicationBlocks.Data
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data
Public Class CustomPublisher
Implements IExceptionPublisher
Public Sub Publish(ByVal exception As System.Exception, ByVal additionalInfo As NameValueCollection, ByVal configSettings As NameValueCollection) Implements IExceptionPublisher.Publish
Try
Dim strConn As String
strConn = ConfigurationSettings.AppSettings.Get("ConnStr").ToString()
-- Some how get the Conn string
SqlHelper.ExecuteNonQuery(strConn,CommandType.StoredProcedure,"usp_InsertException")
-- Some Stored proc to insert ur exception...
Catch ex As exception
-- Do something to catch the exception here, outta scope of EHAB
End Try
End Sub
End Class
3) Configure the Web.config file...
the contents shud go like this....
Now, note that the assembly name must be the Name of the Assembly where the project is deployed and type should be the class name which overrides the Publish method.
Now, in the project, where ever therez an exception, all we need to do is call the method
ExceptionManager.Publish(ex)
The rest is taken care by EHAB.
Wasted a couple of hours working on App.config file..
Realized that App.Config file is for Windows Applications and
Web.config file is for Web Application...
More to Come on the same...
Create the Custom Publisher Class
1) In the Exception Application block, i added a VB class called "CustomPublisher"
2) Code for the class file would go like this...
Imports Microsoft.ApplicationBlocks.ExceptionManagement
Imports Microsoft.ApplicationBlocks.Data
Imports System.Web
Imports System.Data.SqlClient
Imports System.Data
Public Class CustomPublisher
Implements IExceptionPublisher
Public Sub Publish(ByVal exception As System.Exception, ByVal additionalInfo As NameValueCollection, ByVal configSettings As NameValueCollection) Implements IExceptionPublisher.Publish
Try
Dim strConn As String
strConn = ConfigurationSettings.AppSettings.Get("ConnStr").ToString()
-- Some how get the Conn string
SqlHelper.ExecuteNonQuery(strConn,CommandType.StoredProcedure,"usp_InsertException")
-- Some Stored proc to insert ur exception...
Catch ex As exception
-- Do something to catch the exception here, outta scope of EHAB
End Try
End Sub
End Class
3) Configure the Web.config file...
the contents shud go like this....
Now, note that the assembly name must be the Name of the Assembly where the project is deployed and type should be the class name which overrides the Publish method.
Now, in the project, where ever therez an exception, all we need to do is call the method
ExceptionManager.Publish(ex)
The rest is taken care by EHAB.
Wasted a couple of hours working on App.config file..
Realized that App.Config file is for Windows Applications and
Web.config file is for Web Application...
More to Come on the same...
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.
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.
Thursday, March 1, 2007
Check this one out....
http://www.tiddlywiki.com/
A new era of Web Pages...
Can it change the definition of Dynamic Web Pages....
Gotta wait n seee. :)
A new era of Web Pages...
Can it change the definition of Dynamic Web Pages....
Gotta wait n seee. :)
Subscribe to:
Posts (Atom)
