0

I have Created a Windows Service project doing some functionality, then i have installed it in windows services.

I have an ASP.NET Website that is calling that Service and Wait Until Service Stop.

The ASP.NET website simply Start the service and wait for Stopped Event to be raised.

Here is the windows service code:

Protected Overrides Sub OnStart(ByVal args() As String)
    MyEventLogObj = New MyEventLog("Dive Report Service", "Dive Report Service")
    MyEventLogObj.WriteToEventLog("Dive Report Service Started")

    Dim ReportServiceArguments As ReportServiceArguments = ExtractArguments(args)

    If ReportServiceArguments Is Nothing Then
        MyEventLogObj.WriteToEventLog("Invalid Arguments")
    Else
        GenerateReport(ReportServiceArguments)
    End If

    Me.Stop()
End Sub

One Start The Service call GenerateReport() function then Stop itself.

And the ASP.NET Code

    Dim myController As New ServiceController("DiveReportService")
    Dim time As TimeSpan = TimeSpan.FromMinutes(2)
    myController.WaitForStatus(ServiceControllerStatus.Stopped, time)

I want to ask for something, can i make this windows service to return some data from it to the ASP.NET application

oleksii
  • 35,458
  • 16
  • 93
  • 163
Abdullah Darwish
  • 223
  • 2
  • 5
  • 17

0 Answers0