What is advantages of using windows service than windows form

rchiu5hk

Member
Joined
Jul 30, 2008
Messages
5
Programming Experience
1-3
My company is using vb.net windows services to manipulate with comm port communication and print crystal report. Why they don't use general windows form? One reason I think may be is it always listens for comm port for 24 hours every day and it is more stable. Am I correct? Moreover, How to run windows services program and make setup files? I am using VS2003.

Thanks for your assistance,

Raymond
 
rchiu5hk said:
What is advantages of using windows service than windows form
help said:
Microsoft Windows services enable you to create long-running executable applications that run in their own Windows sessions. These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface. These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.
Which means stable, long running processes independent from and protected from any active user sessions. If you need UI interaction with a service you create a regular windows application that does IPC with the service (or use service controller).

About "make setup files?" your best bet is to ask in Deployment forum.
 
My first post in VB.Net forums.

I echo the advantage that a service is better for long running processes. I feel it scales better too.

Here are two of my recent experiences:
I have the responsibility for deploying an application at several manufacturing facilites. The Application has client and server components. The client runs on Windows CE devices and collects data from the plant floor, sending it to the server. Unfortunately, the server component is a Windows Forms application. The server is in a "lights out" computer room. For this application to work, someone must log into the server, start the server Windows form application and leave it running, and leave the server logged in. With always having an active login session on the server, there are downsides in security, support, and reliability. If the application crashes or the server reboots, someone must go to the computer room and login again, and restrat the application. All of this means a longer downtime to the end user.

For another project, I had the opportunity to develop a Windows CE application. I decided right away it needed to have a Windows Service to do the bulk of the work. The Windows Service is configured to Start Automatically with a domain ID created specifically just for this service. If the server reboots, the service restarts - no one is required to do anything.

The client app is completely .NET and runs on CE, Mobile and XP. It communicates with the service via TCP/IP. Almost no processing is done on the client ( which has limited resources as far as CPU & Memory ) other than to accept input from the user, format a request to the server, and recieve a confirmation or rejection/failure message from the server after the request. Once the servie is in place, you can have many clients using the Windows Forms interface. An additional advantage is that all clients should have pretty much the same experience with the application. By this I mean, if all the work was done in a single Windows forms application, then "Bob" who has an old pentium based machine would have a much slower running app than "Bill" who has the new Quad Core. Soon Bob is going to be asking for an expensive upgrade.

Others may disagree, but for remote monitoring and support, I believe the serivce is easier to manage than a windows application. I know if the first application that I had to deploy was a service, it would make support much easier.

You can also create your own Windows Service Controller for your service. This would be a Windows Forms application. You can get as creative as you need to and with this you can dynamically interact with your service.

I hope I gave a good explanation and didn't just ramble on.
 
Last edited:
Back
Top