Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 601627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:44:09+00:00 2026-05-13T16:44:09+00:00

I have a WCF service being hosted in a Windows Service (using techniques discussed

  • 0

I have a WCF service being hosted in a Windows Service (using techniques discussed here) and it works great. I’m now writing a (VB.Net) frontend app that needs to call that service, but I don’t want my users having to fiddle around with the services snap-in and starting the service manually.

Can I write some code to ensure the Windows Service is started, or start it if it isn’t?

Edit: OF course, I can ensure the Service startup is set to automatic, but it doesn’t need to be running all the time, and even then the frontend app still needs to be sure the service is running and start it if it isn’t.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T16:44:10+00:00Added an answer on May 13, 2026 at 4:44 pm

    You can use the ServiceController class to manipulate a service as needed.

    Example from MSDN using the Status property to check if a service needs to be started:

    ' Toggle the Telnet service - 
    ' If it is started (running, paused, etc), stop the service.
    ' If it is stopped, start the service.
    Dim sc As New ServiceController("Telnet")
    Console.WriteLine("The Telnet service status is currently set to {0}", sc.Status)
    
    If sc.Status.Equals(ServiceControllerStatus.Stopped) Or sc.Status.Equals(ServiceControllerStatus.StopPending) Then
       ' Start the service if the current status is stopped.
       Console.WriteLine("Starting the Telnet service...")
       sc.Start()
    Else
       ' Stop the service if its status is not set to "Stopped".
       Console.WriteLine("Stopping the Telnet service...")
       sc.Stop()
    End If
    
    ' Refresh and display the current service status.
    sc.Refresh()
    Console.WriteLine("The Telnet service status is now set to {0}.", sc.Status)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have WCF services being self-hosted by a Windows Service inside our domain, using
I have a WCF service that is hosted on a Windows Service. Now I
I have a WCF service being hosted in a Windows Service and is being
I have a WCF service that is being hosted in a windows service and
I have a WCF service which will be hosted under IIS. Now I have
I have a per-call WCF service that's being hosted in IIS (.svc). In the
I have a REST WCF service that is being hosted in IIS. I have
I have a simple WCF service hosted in a windows service. The service itself
I have a asp.net 2.0 web site with WCF service hosted inside it running
I have a WCF service written in C# being hosted on a remote machine,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.