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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:19:50+00:00 2026-05-16T22:19:50+00:00

We are developing a Windows Presentation Foundation Application that we would like to be

  • 0

We are developing a Windows Presentation Foundation Application that we would like to be able run as a Windows Service.

Anyone done something like that?
Is it possible?

We don’t need to interact with the Desktop or any GUI, it would just be nice to have one App that we can run with a GUI, from the Command Line (that works) or as a Service.

Looking forward to interesting input 🙂

  • 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-16T22:19:51+00:00Added an answer on May 16, 2026 at 10:19 pm

    As a rule of thumb services should never have any kind of UI. This is because services usually run with very high privileges and bad things can happen if you are not super careful with your inputs. (I think the newest versions of Windows won’t let you create UI from a service at all but I am not 100% sure.)

    If you need to communicate with a service, you should use some form of IPC (WCF, pipes, sockets, …). If you want a simple console program that can also be a service, I know of a trick to set that up:

    class MyExampleApp : ServiceBase
    {
        public static void Main(string[] args)
        {
            if (args.Length == 1 && args[0].Equals("--console"))
            {
                new MyExampleApp().ConsoleRun();
            }
            else
            {
                ServiceBase.Run(new MyExampleApp());
            }
        }
        private void ConsoleRun()
        {
            Console.WriteLine(string.Format("{0}::starting...", GetType().FullName));
    
            OnStart(null);
    
            Console.WriteLine(string.Format("{0}::ready (ENTER to exit)", GetType().FullName));
            Console.ReadLine();
    
            OnStop();
    
            Console.WriteLine(string.Format("{0}::stopped", GetType().FullName));
        }
        //snip
    }
    

    If you just start the program, it will launch as a service (and yell at you if you run it from the console), but if you add the paramter --console when you start it, the program will launch and wait for you to hit enter to close.

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

Sidebar

Related Questions

We're developing a large desktop application using Windows Presentation Foundation. Currently, the application is
I'm developing a Windows Service in VB.NET 2008, but I feel like I'm going
I'm developing a Windows service which will run at a specific time every day.
Iam developing a windows phone application that makes use of windows phone push notification
Im developing a windows forms application using C# 4.0 and that application is going
I'm developing a Windows application that has a silent updater, so the executable needs
I am Developing Windows Form Application in .Net, I want to insert selected rows
I am developing Windows Phone 7 application in which I send encrypted data to
I am developing windows CE 6.0 for VIA board. I have a MFC application
I am developing a windows phone application. The webclient does not fire as I

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.