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

  • Home
  • SEARCH
  • 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 7048381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:53:06+00:00 2026-05-28T02:53:06+00:00

I have wrote a Windows Service and I have a admin panel which I

  • 0

I have wrote a Windows Service and I have a admin panel which I can configure this service from a web page. In order to this I am using a database. So basically what I am doing is I change the values from the db and the service reads it and it changes its execution time.. etc.

My problem is in my development server everything works fine. When I install my service and upload the web page to the production server I am getting this error

The type or namespace name ‘ServiceController’ could not be found (are you missing a using directive or an assembly reference?)

It is giving this error in my web page. I have checked the service it is installed and works fine but when I am trying to go to the configuration page for the service it hrows this exception. In my project i see that I have using System.ServiceProcess; is added in the top and when I build my solution this dll reference error doesnt show up. Also in the designer it seems like it is already imported:

<@ Import Namespace="System.ServiceProcess">; What might be the problem? Can it be a 32-bit / 64-bit issue? ( I know it doesnt make sense but any help will be appreciated)

ServiceController agService = new ServiceController("Buddy Service");
while (agService.Status == ServiceControllerStatus.Running)
{                   
  lblServiceStatus.Text = "Running";
  lblServiceStatus.ForeColor = Color.LimeGreen;
  btnStopService.Enabled = true;
  btnStartService.Enabled = false;
  break;
}

It throws the exception on the line

ServiceController agService = new ServiceController("Buddy Service");

I have made sure that “Buddy Service” is in the Services list and it does.

  • 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-28T02:53:07+00:00Added an answer on May 28, 2026 at 2:53 am

    It sounds like you have the assembly referenced correctly.

    Try changing this line:

    ServiceController agService = new ServiceController("Buddy Service");
    

    to this:

    var agService = new System.ServiceProcess.ServiceController("Buddy Service");
    

    If this works, you will probably also need to change this line:

    while (agService.Status == ServiceControllerStatus.Running)
    

    to this:

    while (agService.Status == System.ServiceProcess.ServiceControllerStatus.Running)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to read/write some registry information from my non-admin Windows Service, and have
I wrote a VB.NET Windows Service, which works fine. I have only one issue
I have created a windows service which allows communications via namedpipes. This code worked
I have a VB.NET Windows Service that I wrote and it works fine. In
I have wrote a web service, in a nutshell it uses openpop to get
I have a client that's utilizing a windows service I wrote that polls a
I have created one windows service which send an email notifications to users (list
I have successfully created a Python Windows service using pywin32. In testing my application
I wrote a windows service (and it runs fine). Now i have a separate
I have run into a brick wall with a Windows Service I wrote. The

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.