How do I create a Windows Service using vb.net in Studio 2008 Standard (No template) -


I want to create a Windows service using VBnet, but in the VS 2008 standard, you have the "Windows service" template I have used before.

What is the best way to create such a service without using the C ++ template?

Thanks

There is really nothing special about the Windows service template. It creates two square files in your project and adds a reference to System.ServiceProcess :

Service1.vb:

  public class Service1 Protected Override SubOnStart (ByVal as args () string) "Add code here to start your service. This method should set some things in motion so that your service can do its job. End Protected Overrides All OnStop () "Add code here for any tear required to stop your service. End Sub Ending Class  

Service1.Designer.vb:

  Import System.ServiceProcess & LT; Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated () & gt; _ Acquisition of partial Class Service System 1. service of process. Service Buzz '' User Service Override Component List to Clear Settlement & LT; System.Diagnostics.DebuggerNonUserCode () & gt; Try the Settlement Settlement as Defined Override Sub (Boolean) Settle and then components also do nothing and then components.Dispose () end if end try ending MyBase.Dispose (Settlement) End Sub Process & Lt main entry point isnot; MTAThread () & gt; _ & Lt; System.Diagnostics.DebuggerNonUserCode () & gt; _ Shared sub-main () as the default service system () system. Service Process ServiceBase '' More than one NT service can run within the same process. To add another service to this process, change the following line to create another service object. For example, '' 'ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}' 'ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1} System.ServiceProcess.ServiceBase.Run (ServicesToRun) ) End Sub 'Note' required by component components such as System.ComponentModel.IContainer Personal components': The following procedure is required for component designers' 'It can be modified using component designer. 'Do not modify it using the code editor & lt; System.Diagnostics.DebuggerStepThrough () & gt; _ Private sub InitializeComponent () components = New System.ComponentModel.Container () Me.ServiceName = "Service1" means the last sub-end class  

Comments

Popular posts from this blog

MVP, design question -

excel - Populate list via a bi-Condition -

iphone - How do I make a UIPickerView in a UIActionSheet -