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 4582348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:03:43+00:00 2026-05-21T21:03:43+00:00

I have created a C# .Net windows service. There are some configuration files which

  • 0

I have created a C# .Net windows service. There are some configuration files which are being used by this service. Right now we have another dll component which is being loaded by an application and from there we create the configuration files. I want to open this dll component from my directly service. Following the option that I want to provide in final service exe which will act as service as well as configurator.

Lets say exe name is SampleServ.exe then options should be:

  1. With out any arguments it should start as service
  2. With argument like SampleServ.exe -config (it should start configurator instead of service)

I am trying like this

public static void Main(string[] args)
{
    if (args.Length == 0)
    {
        ServiceBase[] ServicesToRun;
        ServicesToRun = new ServiceBase[] 
        { 
           new Service1() 
        };
        ServiceBase.Run(ServicesToRun);

    }
    else
    {
        MainPage wnd = new MainPage();
        wnd.ShowDialog();
    }
}

Here MainPage is derived Window, and i am not able to add namespace system.window because of service limitation.

Please let me know if other way is possible.


After adding some more component in project reference I am able to do this. I have added reference like “PresentationCore”, “PresentatinoFramework”, “System.Xaml”. I just wanted to know if any implication of adding such component.? Any idea?

Otherwise now my code is working…

  • 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-21T21:03:44+00:00Added an answer on May 21, 2026 at 9:03 pm

    Hi here is a complete example of what you need, it also include a install/uninstall feature

    http://blogs.microsoft.co.il/blogs/kim/archive/2009/01/04/self-installing-windows-service.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .NET windows service which acts as a host for some wcf.
I have a .NET Windows service which self hosts a WCF service. This WCF
I have created a Windows Service in VB.net for building xML from a database.
We have a Windows Service created in .Net 4.0, the services parses large text
I have a .Net 4.0 C# Windows Service which spawns a number of thread
Im using c# .net windows application form. I have created many databases with many
Im using c# .net windows form application. I have many databases created using sql
hello i have created one windows application in c# .net and its working fine
I have created several DLL (.NET) libraries that are used in several projects. In
I have created a new VS2008 ASP.Net Web service project, with the default name

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.