Ask a questionAsk a question
 

Questionwindows service problem

  • Friday, November 06, 2009 8:38 PMgusadolfo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi i'm having problems debugging a windows service and i keep getting the same warning, i tried attaching it to a process and it didn't work:

    Imports System.ServiceProcess
    Public Class MotoStoreUpdate
        Private update As UpdateBase = New UpdateBase()   
        Public Sub New()
            MyBase.New()
            InitializeComponent()
        End Sub

        Shared Sub Main()
            Dim ServicesToRun() As System.ServiceProcess.ServiceBase
            ServicesToRun = New System.ServiceProcess.ServiceBase() {New MotoStoreUpdate()}
            System.ServiceProcess.ServiceBase.Run(ServicesToRun) -> Here's where it stops
        End Sub

        Protected Overrides Sub OnStart(ByVal args() As String)
            update.Start()
        End Sub
        Protected Overrides Sub OnStop()
            update.Abort()
        End Sub
        Protected Overrides Sub OnShutdown()
            update.Abort()
        End Sub
    End Class

    this is the what i get:

    Cannot start service from the command line or a debugger. A windows service must first be installed (using installutil.exe) and then started with the ServerExplorer, Services Admin Tool or the Net Start command

    if you need something else let me know

All Replies

  • Friday, November 06, 2009 10:59 PMMalange Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    have a look here please:

    http://social.msdn.microsoft.com/Search/en-US?query=windows%20service%20problem&ac=8
    Don't judge me, just Upgrade me. Thanks!
  • Monday, November 09, 2009 3:24 PMgusadolfo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    i already checked pretty much everything in there, specially Walkthrough: Creating a Windows Service Application in the Component Designer and it's all done and still doesn't work
  • Monday, November 09, 2009 4:41 PMgusadolfo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I found this online that might work:
    http://www.worldofasp.net/tut/WindowsService/Creating_Windows_Services_in_NET_99.aspx
    there's a section called Tips for Debugging Windows Services that i'm testing to see if it works
  • Tuesday, November 17, 2009 6:37 PMgusadolfo Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    That helped a little but i still get the same problem:

    Shared Sub Main()
            Dim sArgs As String()
            sArgs = System.Environment.GetCommandLineArgs()
            If sArgs.Length > 1 Then
                If sArgs(1).ToLower() = "console" Then
                    Dim oService As New MotoStoreUpdate()
                    oService.OnStart(sArgs)
                End If
            End If
            Dim ServicesToRun As System.ServiceProcess.ServiceBase()
            ServicesToRun = New System.ServiceProcess.ServiceBase() {New MotoStoreUpdate()}
            System.ServiceProcess.ServiceBase.Run(ServicesToRun)
        End Sub

    i still get:

    Cannot start service from the command line or a debugger. A windows service must first be installed (using installutil.exe) and then started with the ServerExplorer, Services Admin Tool or the Net Start command