VB.Net running as a service

4.1k views Asked by At

I have built an application that connects to the exchange server and does some scanning tasks on the incoming mail.

Application has a form where i can start and stop scanning,give in an interval, do some other configuration, and a notificationicon in the taskbar to show hide,end and so on..

The problem is that I would like the application to start as a service, because now a user has to log in first on the server before it starts working.

I tried some tools like RunAsService, i had a service, but obviously it didn't run the application.

Of course i understeand now that when the application will run as a service, scanning will be the only thing that will happen, no forms and no notification icons.

However i do not know where to start, should i extract the scanning logic from my configuration as a separate application? What application type should it become then ?

2

There are 2 answers

2
SysDragon On BEST ANSWER

You have two easy options.

First one just create a new Windows Service Project from your New Project button in the Visual Studio, and then just program your app.

Second one, just create a service from the service management window in your computer and add the executable file of your program. It will start running as a service (with visible windows and everything as you coded it).

1
Pawan On

You should follow this link and schedule your vb.net windows program as windows task

In Your code, at the end ,when everything gets executed you should write Me.Close() to hide your form.