locked
Console.writeline not working? RRS feed

  • Question

  • Hi, i've been doing research about this for a while now. I'm pretty sure it's correct, but the console.writeline is not providing any messeges when program is executed. Im using Visual Studio 2010 pro. Is there anything im missing or doing wrong? Here's what i have:

     Private Sub CheckServiceButton_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckServiceButton.Click
            ' This will check if the service is running '
           
            Dim sc As New ServiceProcess.ServiceController()
            sc.ServiceName = "Themes"
            MessageBox.Show("The Themes service status is currently set to Running")

            If sc.Status = ServiceProcess.ServiceControllerStatus.Running Then
                ' Start the service if the current status is stopped '
                Console.WriteLine("Starting the Themes service")

                Try
                    ' Start the service, and wait until its status if "Running".
                    sc.Start()
                    sc.WaitForStatus(ServiceProcess.ServiceControllerStatus.Running)

                    ' Display the current service status '
                    Console.WriteLine("The Themes service status is now set to {0},", sc.Status)

                Catch ex As Exception
                    Console.WriteLine("Could not start the Themes service.")
                    Console.ReadLine()


                End Try
            End If

        End Sub

     

    Thanks.

     

    Monday, May 9, 2011 8:36 AM

Answers

  • Hi,

    The problem looks like on the Windows Service application But this Forum is for WCF.

    Anyways if you want to your service to interact with Windows (any forms or Console) you should enable "Allow Desktop interaction" option on your service.

     

    /Srinivas

    • Marked as answer by GeekzInside Monday, May 9, 2011 9:45 AM
    Monday, May 9, 2011 9:38 AM

All replies

  • Hi,

    The problem looks like on the Windows Service application But this Forum is for WCF.

    Anyways if you want to your service to interact with Windows (any forms or Console) you should enable "Allow Desktop interaction" option on your service.

     

    /Srinivas

    • Marked as answer by GeekzInside Monday, May 9, 2011 9:45 AM
    Monday, May 9, 2011 9:38 AM
  • Thank you Srinivas. I am sorry i posted in the wrong forum.
    Monday, May 9, 2011 9:45 AM