Senator Guerra Souty original series calendar,replica hublot blue steel peach pointer collocation of rolex replica Rome digital scale, track type minute replica watches scale shows that the classical model is swiss replica watches incomparable, wearing elegant dress highlights.
mr-ponna.com

 


C# Windows Services articles and tutorials

Read C# Windows Services articles

Sort by:

<< Start < Prev 1 Next > End >>
Page 1 of 1

C# Windows Services articles and tutorials

# articles: 1  


Creating Windows Services with Visual Studio 2008

View(s): 7891

Creating Windows Services with Visual Studio 2008

A Windows services is a application that runs in the background.  There is documentation on the Web for creating a Service with Visual Studio 2003, but is is changed for VS 2005, and 2008.

I will walk thru a sample Service in Visual Studio 2008.  This should also work with VS 2005.

Create the Service.

Description: Description: servicecreate

From Visual Studio Start Page, choose create project…   Select Windows Service and give it a name of NewService.

Description: Description: serviceblank

First thing we will do is add a timer to the Service.  DO NOT USE THE TIMER IN THE TOOLBOX.  The Timer for Windows Forms does not work for Services.  We will have to find the System.Timers.Timer component by right clicking on the Toolbox, and Choose Items.

Find the one that matches below:
Description: Description: servicetimerchoose

Click OK.  This will put the Timer into the Printing section of the Toolbar for some reason.

From The Service1 designer.  Click on Timer1, and set the interval to 10000 (10 Seconds).  Then Double-click to open Code View for Timer1_Elapsed.


Add the Following Code to the Timer1_Elapsed:

Dim MyLog As New EventLog() 
‘ create a new event log 
‘ Check if the the Event Log Exists

If Not 
MyLog.SourceExists(“NewService”) Then 
MyLog.CreateEventSource(“NewService”, “NewService_Log”) ‘ Create Log
End If 

MyLog.Source = “NewService” ‘ Write to the Log 
MyLog.WriteEntry(“NewService_Log”, “Service is Running” _ , EventLogEntryType.Information)

End Sub

And For OnStart():

Protected Overrides

(Continued...) View Full Aritlce


  Last updated on Friday, 21 February 2014
  Author: Mr. Ponna
2/5 stars (2 vote(s))

<< Start < Prev 1 Next > End >>
Page 1 of 1
Register Login Ask Us Write to Us Help