Je suis en train d'écrire un petit service Windows dans .NET 3.5, vérifiez que tous les 10 mn ou si toi sont de nouveaux fichiers dans « C: \ demofolder », puis envoyer un courrier électronique à. Jusqu'à présent, je l'ai fait ici, comme dans le code suivant, puis il y a erreur dansservice Windows
Imports System
Imports System.Timers
Imports System.ServiceProcess
Public Class TestMyService
' A timer that controls how frequenty the example writes to the
' event log.
Private serviceTimer As Timer
Public Sub New()
' Set the ServiceBase.ServiceName property.
ServiceName = "TestMyService Service"
' Configure the level of control available on the service.
CanStop = True
CanPauseAndContinue = True
CanHandleSessionChangeEvent = True
' Configure the service to log important events to the
' Application event log automatically.
AutoLog = True
End Sub
Protected Overrides Sub OnStart(ByVal args() As String)
' Add code here to start your service. This method should set things
' in motion so your service can do its work.
End Sub
Protected Overrides Sub OnStop()
' Add code here to perform any tear-down necessary to stop your service.
End Sub
Public Shared Sub Main()
' Create an instance of the TestMyService class that will write
' an entry to the Application event log. Pass the object to the
' shared ServiceBase.Run method.
ServiceBase.Run(New TestMyService)
End Sub
End Class
Sub New Public() Je suis le message d'erreur suivant:
Sub Main' est déclarée plus une fois dans 'mcWinService.TestMyService': mcWinService.TestMyService.Main(), mcWinService.TestMyService.Main()
Public Partagé Sub Main() 'a plusieurs définitions avec des signatures identiques.
Public Sub New() » dans le type concepteur généré 'mcWinService.TestMyService' devrait appeler la méthode InitializeComponent.
Merci pour l'exemple et les liens. – Narazana