|
How to Run any WinForms GUI Application as a Windows Service with AlwaysUp |
Automatically start your WinForms GUI in the background as a Windows Service, before anyone logs on. No need to modify your code!
Windows Forms (WinForms) is a widely-used GUI
API included with the .NET Framework.
Prior to the introduction of WPF in 2006, WinForms was the API of choice for .NET applications presenting a graphical user interface.
AlwaysUp includes advanced tools to make your WinForms executable start at boot and run 24/7.
The Application Advisor will help you install your WinForms executable as a Windows Service with all our recommended settings — in just a few clicks. Simply select Advisor from the Application menu and follow the straightforward prompts.
To run your WinForms application as a Windows Service with AlwaysUp:
-
Download and
install
AlwaysUp, if necessary.
-
Start AlwaysUp.
-
Select Application > Add to open the Add Application window:
-
On the General tab:
-
In the Application field, enter the full path to your WinForms application.
For this tutorial, we will be running the
CodeProject Social Club sample application,
which uses WinForms, C#.NET, ADO.NET and MS Access. The full path to the application is:
C:\WinForms\SocialClub\John.SocialClub.Desktop.exe
and that will appear throughout. No doubt the path to your application will be different!
-
In the Name field, enter the name that you will call the WinForms application in AlwaysUp.
We have entered My WinForms App but you can specify virtually anything you like.
-
Click over to the Logon tab and enter the user name and password of an account that can run your WinForms application normally.
Without this, your application may not find its settings (registry, permissions, etc.) and fail to run properly.
-
If your Windows Forms program needs the network to do its work, click over to the Startup tab and check the
Ensure that the Windows Networking components have started box.
-
Click the Save button. In a couple of seconds, an application called My WinForms App will show up in the AlwaysUp window.
It is not yet running though.
-
To start your WinForms application, choose Application > Start "My WinForms App".
The state of the entry should transition to Running after a few seconds:
Note that because of Session 0 isolation,
your WinForms application will not appear on your screen. It will be running in the background, on an invisible desktop where all Windows Services operate.
If you wish to see your application, select Application > Restart "My WinForms App" in this session from the AlwaysUp menu.
That tells AlwaysUp to stop your application in session 0 and restart it visibly on your desktop.
-
That's it! Next time your computer boots, your WinForms application will be launched immediately, before anyone logs on.
Please reboot your PC now to test that everything works as expected.
Afterwards, be sure to explore the other settings in AlwaysUp that may be helpful in your situation.
For example, configure email alerts that notify you when the application fails, restart your app nightly to clear out memory leaks, and much more!
WinForms program not working properly as a Windows Service?
Consult the AlwaysUp Troubleshooter —
our online tool that can help you resolve the most common problems encountered when running an application as a Windows Service.
From AlwaysUp, select Application > Report Activity > Today to bring up an HTML report detailing the interaction
between AlwaysUp and your application.
The AlwaysUp Event Log Messages page explains the messages that may appear.
Browse the AlwaysUp FAQ
for answers to commonly asked questions and troubleshooting tips.
Contact us and we'll be happy to help!
|
Over 97,000 installations, and counting!
|
 |
|
Rock-solid for the past 20+ years!
|
Fully Compatible with 160+ Applications...
|