Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
I have developed my application in VB.NET. I want to run windows application as windows service. I am calling many dlls in my application and connecting application with Oracle etc.

Now please help me how to run Windows application as Windows Service and the application should be viewable to user when it is running...

Thanks in advance
Posted
Updated 9-Jun-11 1:44am
v2

In Vista and Windows 7, it's not possible to run a WinForms app as a Windows service. You have to create an actual Windows Service application (which means any interface elements cannot be used).

4.5 million Google serach results for ".net windows service tutorial"
[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Jun-11 12:05pm    
Right, my 5.
--SA
Sergey Alexandrovich Kryukov 9-Jun-11 12:10pm    
However, I'm not sure how about Windows 7. Please see my comment to Dave's answer -- I created a dual mode thing. Not sure, but I think it worked in Windows 7 in principle, because -- why not?
--SA
You can't do that. Windows Service applications should not show a user interface at all. You cannot run all Windows Applications as a service and expect them to work. Since they cannot show a user interface that the user can see, if the app is waiting for the user to do something, it'll never happen.

Rewrite your app properly for this type of environment. The Server app should do it's work autonomously and if you need the user to tell it what to do, write a second application that communicates with the service, such as through a named pipe or some other interprocess communication method, to tell it what to do.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 9-Jun-11 12:09pm    
This is all good (my 4), but I developed a framework for running an application in dual mode -- Interactive (with WPF though, but could be Forms or console) and Windows Service. What it runs as Windows Service, Application.Run is never called -- simple, right? At the same time, this is strictly the same application and EXE file. Interactive mode is used for on-screen logging and control of the Windows Service which can possibly run in a second instance.

--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900