Library code snippets

Health Monitoring in ASP.NET 2

WebEvents Class

Imports DeveloperMeeting
Imports DeveloperMeeting.DataProvider

Namespace EventLog
    Public NotInheritable Class WebEvents #Region " Constructor "
        Public Sub New(ByVal ConnectionString As String)             _ConnectionString = ConnectionString             DSEventLog = SqlDataProvider.FillDataSet(ConnectionString, _             "DM_WebEvent_GetLogEvent", _ CommandType.StoredProcedure, Nothing)         End Sub #End Region

#Region " Declarations "
        Dim DSEventLog As New DataSet
        Dim _ConnectionString As String
#End Region
#Region " Propreties "
        Public ReadOnly Property Count() As Integer
            Get
                Return DSEventLog.Tables(0).Rows.Count
            End Get
        End Property
#End Region #Region " GetEventLog Method "
        Public Function GetEventLog(ByVal Index As Integer) As [Event]
            Dim Return_Value As New [Event]
            With Return_Value
                .EventID = DSEventLog.Tables(0).Rows(Index)("EventId")
                .EventTimeUtc = DSEventLog.Tables(0).Rows(Index)("EventTimeUtc")
                .EventTime = DSEventLog.Tables(0).Rows(Index)("EventTime")
                .EventType = DSEventLog.Tables(0).Rows(Index)("EventType")
                .EventSequence = DSEventLog.Tables(0).Rows(Index)("EventSequence")
                .EventOccurrence = DSEventLog.Tables(0).Rows(Index)("EventOccurrence")
                .EventCode = DSEventLog.Tables(0).Rows(Index)("EventCode")
                .EventDetailCode = DSEventLog.Tables(0).Rows(Index)("EventDetailCode")
                .Message = IIf(DSEventLog.Tables(0).Rows(Index)("Message") Is DBNull.Value, _
vbNullString, DSEventLog.Tables(0).Rows(Index)("Message"))
                .ApplicationPath = IIf(DSEventLog.Tables(0).Rows(Index)("ApplicationPath") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index)
("ApplicationPath"))
                .ApplicationVirtualPath = IIf(DSEventLog.Tables(0).Rows(Index) _
("ApplicationVirtualPath") Is DBNull.Value, vbNullString, _
DSEventLog.Tables(0).Rows(Index)("ApplicationVirtualPath"))
                .MachineName = DSEventLog.Tables(0).Rows(Index)("MachineName")
                .RequestUrl = IIf(DSEventLog.Tables(0).Rows(Index)("RequestUrl") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index)("RequestUrl"))
                .ExceptionType = IIf(DSEventLog.Tables(0).Rows(Index)("ExceptionType") _
Is DBNull.Value, vbNullString, DSEventLog.Tables(0).Rows(Index) _
("ExceptionType"))
                .Details = IIf(DSEventLog.Tables(0).Rows(Index)("Details") Is DBNull.Value, _
vbNullString, DSEventLog.Tables(0).Rows(Index)("Details"))
            End With
            Return Return_Value
        End Function

        Public Function GetEventLog() As DataSet
            Return DSEventLog
        End Function
#End Region #Region " ClearAllEvent Method "
        Public Sub ClearAllEvent()
            SqlDataProvider.ExecuteQuery(_ConnectionString, "DM_WebEvent_ClearAllEvent", _
CommandType.StoredProcedure, Nothing)
        End Sub
#End Region
    End Class End Namespace

Comments

  1. 22 May 2006 at 06:53

    Hi Mehdi Golchin,

    Thanks for you guide. I have successed to configure the aspnet_regsql.

     

    regard,
    Jason

  2. 21 May 2006 at 18:39

    Hi Jason,
    Health monitoring uses SQL Server for storing web events. so you must add health monitoring's tables and stored procedures. for that you have tow solutions. you can use aspnet_regsql command in visual studio command prompt or if you like to create a installation page for your project you can use
    that code which generates health monitoring's tables and stored procedures as run-time.

  3. 21 May 2006 at 15:48

    Dear Mehdi Golchin,

    With regard to your Step 1, can you please explain more in details "run-time mode". As i do not know where to install it Many thanks...

    Step 1 : Installing Web Event
    You can do this easily in run-time mode with this code below:

    Management.SqlServices.Install("Computer Name", "SQL user name",
    "SQL password", "Database name", Management.SqlFeatures.

    SqlWebEventProvider)

     
    Regard,
    Jason

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Health Monitoring in ASP.NET 2.

Leave a comment

Sign in or Join us (it's free).

AddThis

Related podcasts

  • CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly Media

    CodeCast Episode 4: State of .NET, IE8, ASP.NET MVC, and O'Reilly MediaHosts Ken Levy and Markus Egger discuss the new State of .NET events, IE8, ASP.NET MVC, followed by an interview from PDC with two editors from O'Reilly Media. More on ASP.NET MVC can be found at http://asp.net/mvc. Interview...

Related jobs

Events coming up

  • Dec 9

    Internet Information Services 7.0 for ASP.Net Developers

    Glasgow, United Kingdom

    One of the biggest and best new features of Windows Server 2008 and Windows Vista is Internet Information Server 7.0.  IIS 7.0 is the latest and most significant release of Microsoft's Web Server. With this release comes a new extensibility model which gives developers more options than ever before, more diagnostic tools with which developers can debug and locate issues. During the session Andrew will investigate the new architecture, look at extending, configuring and developing for IIS7, ta...