Click here to Skip to main content
15,884,628 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body!!!
Thanks so much for read the topic, so
i have created a service windows, follow http://msdn.microsoft.com/en-us/library/aa984464(v=vs.71).aspx[^]
But, when i start my service, i have get message box same as :
---------------------------
Services
---------------------------
Windows could not start the ExampleService service on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.
---------------------------
OK
---------------------------

After, i have read mylogEvent : the contents
=========================================
VB
The ExampleService service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
A timeout was reached (30000 milliseconds) while waiting for the ExampleService service to connect.

=========================================
Here is my code in Service1.vb :
VB.NET
Imports System.ServiceProcess

Public Class ExampleService

    Shared Sub Main()
        Dim ServicesToRun() As System.ServiceProcess.ServiceBase
        ' Change the following line to match.
        ServicesToRun = New System.ServiceProcess.ServiceBase() _
           {New ExampleService()}
        System.ServiceProcess.ServiceBase.Run(ServicesToRun)
    End Sub

    Public Sub New()
        MyBase.New()
        InitializeComponent()
        If Not EventLog.SourceExists("MySource") Then
            EventLog.CreateEventSource("MySource", "MyNewLog")
        End If
        EventLog1.Source = "MySource"
        EventLog1.Log = "MyNewLog"
    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.
        EventLog1.WriteEntry("In OnStart")
    End Sub

    Protected Overrides Sub OnStop()
        ' Add code here to perform any tear-down necessary to stop your service.
        EventLog1.WriteEntry("In OnStop.")
    End Sub

End Class


===== Plz help me.
I don't known, why is accident!!!
Thanks so much
Have a nice day!
Posted
Updated 30-Sep-13 0:27am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900