Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

[3441] Creating a Windows Service in VB.NET

Last post 05-23-2008 10:35 AM by mekaushik. 102 replies.
Page 1 of 7 (103 items) 1 2 3 4 5 Next > ... Last »
Sort Posts: Previous Next
  • 01-01-1999 12:00 AM

    [3441] Creating a Windows Service in VB.NET

    This thread is for discussions of Creating a Windows Service in VB.NET.

    • Post Points: 380
  • Advertisement

    • Red Gate Software

    Advertisement

    Want to boost your .NET application performance?

    Some developers always seem to write efficient and lightening-fast code. What is their secret? It’s ANTS Profiler. “We improved the performance of the application up to 10 times” Dan Ports, Intrigma.

    Try it for yourself now.

  • 03-15-2003 1:21 AM In reply to

    • mphilmon
    • Not Ranked
    • Joined on 03-15-2003
    • New Member
    • Points 5

    Some caveats

    1) You CAN debug the startup code (putting a break point in OnStart), you just have to be tricky about it. I do it by simply putting this code at the begining of OnStart:
    Code:

    #If Debug Then
           ' When debugging a service, you have to attach to a running process. This gives me
           ' time to attach for debugging to slowdown startup so I can set a breakpoint.
           System.Threading.Thread.Sleep(15000)
    #End If

    Obviously this gives me a 15 second window in which I can attach to the process and set my breakpoint in the top of my startup code. It's not a perfect solution, but better than nothing.

    2) InstallUtil is a nice, quick utility for installing and uninstalling, however it lacks some pretty substantial support for certain settings. It doesn't allow you to setup the service at all... for instance you can't have it handle the "Allow service to interact with desktop" option (which ALSO doesn't appear to be an option in the required Installer class you must add to your service) NOR can you use it to set Dependencies to make sure Windows loads your service in the proper order at startup (if you use Automatic)... someone hinted that this could be set in that installer class as well but I've not been able to find that option. The only way I've found to overcome these limitations is by either manually setting it up after installing it (not an option for dependencies), hacking the registry yourself (not a wise choice) or by using a product like InstallShield which can do it all for you quite nicely.


    • Post Points: 0
  • 05-08-2003 9:38 AM In reply to

    how to start and stop windows services remotely

    i want to access remote windows services.basically i want to to write some code in onstart event of windows service and install it in server.from client i want to start the server service.


    how can i install windows service remotely(server)?
    • Post Points: 0
  • 06-03-2003 3:17 PM In reply to

    • rslosey
    • Not Ranked
    • Joined on 06-03-2003
    • New Member
    • Points 5

    Not enough to show the use of a windows service

    The example was not a very good example. Windows services can be communicated with from other programs. This is also a very important part of windows services and no examples were used to show this part of it
    • Post Points: 0
  • 08-28-2003 12:01 PM In reply to

    .net service

    Hi,

    I am creating a service using visual basic .net. I am trying to click 'Add installer' and add installers. I get this error "The .Net assembly' System.configuration.Install' could not be found. and "Could not run 'C:\Program Files\Microsoft Visual Studio .NET\Vb7\VBProjectItems\Installer.vsz' wizard.

    Can some one tell me what this means and how to slove this.

    I appreciate your help

    Regards
    Hari V
    • Post Points: 0
  • 10-14-2003 5:22 AM In reply to

    • danielsn
    • Not Ranked
    • Joined on 10-14-2003
    • New Member
    • Points 10

    Windows Service using Timer

    Hi,

    I tried to write a Windows Service application under VB.Net. Problem is, that I'm using the Standard Edition and no service template is available. However MS tells me how to write a service programmatically, which I tried. The service seems to work fine (starts up and writes the first line in the logging file which I created at StartUp).
    I use a Timer to tell it to write a line every 10 sec. This is where the problem starts: the timer doens't seem to start. The logging file isn't updated.

    I have tried this in several ways, but still think a parameter or something has been set wrong (this is what the template normally does).

    Does anyone have a clou.....or a template for me?? I have included a simple project.

    Regards,

    Daniel (danielsn@wxs.nl)
    • Post Points: 10
  • 10-24-2003 3:19 PM In reply to

    • ronco
    • Not Ranked
    • Joined on 10-24-2003
    • New Member
    • Points 10

    VB6 and .Net services

    I have an application in VB6 that I want to run as a service.  Can I make it run as a windows service using .Net like this article shows, if so how?

    Does the machine require .Net to use the InstallUtil, or can I use another method to install/register the service on a non-.Net machine.

    Thanks in advance!

    Ron
    • Post Points: 0
  • 11-07-2003 5:51 AM In reply to

    please help me

    i am interested in learning to writhe windows service program . please be good to give instructions and sample code that u have develop .

    i am ishrath from sri lanka.

    thanks
    Ishrath
    • Post Points: 0
  • 11-14-2003 4:30 PM In reply to

    • vedire
    • Not Ranked
    • Joined on 11-14-2003
    • New Member
    • Points 30

    Service Start Parameters

    We have bunch of windows services that are deployed on various machines. They are configuring them self’s by getting the configuration variables from a database when they are started.

    Now we have requirement to create some isolated systems which are small foot print replicas of our main system. So we want to install these windows services on this isolated system with out any changes. That means we will have to make the service look at a different database for configuration values.

    One of the various options we are looking into is "using Start Parameters".

    The problem with the Start Parameters is that they do not persist. When ever we stop and start the service we will have re-enter them.

    So my question is there a way to make these persistent or provide some command line parameters at install or start.
    • Post Points: 0
  • 12-04-2003 10:36 PM In reply to

    • bluffrat
    • Not Ranked
    • Joined on 12-04-2003
    • New Member
    • Points 20

    Adding Installer to Setup Project

    How could you run the installer in a Setup Project???
    • Post Points: 0
  • 12-22-2003 9:52 AM In reply to

    • Seposm
    • Not Ranked
    • Joined on 12-22-2003
    • New Member
    • Points 5

    Timer in a service

    Make sure that you are using a component timer and not a windows form timer, I made that mistake on my first service.
    In Code it would look like this.
    Correct:
    Friend WithEvents MainTimer As System.Timers.Timer
    Incorrect:
    Friend WithEvents JunkTimer As System.Windows.Forms.Timer

    Hope this helps
    • Post Points: 0
  • 01-07-2004 10:03 AM In reply to

    • alfour
    • Not Ranked
    • Joined on 01-07-2004
    • New Member
    • Points 10

    VB6 and Net services

    Visual Basic isn't most appropriate tool for developing of Windows NT/2000/XP services. The problem is, for service development is necessary to use API function CreateThread, which is not supported nether in VB5, nor in VB6. VB allows creation of multi-thread programs, but not using CreateThread function.
    Even if you using create service options build-in Indigorose Setup Factory 6 your ***.exe written in VB won't start as a service.
    That's about it.
    regards


    • Post Points: 0
  • 01-07-2004 10:04 AM In reply to

    • alfour
    • Not Ranked
    • Joined on 01-07-2004
    • New Member
    • Points 10

    one more

    • Post Points: 0
  • 02-10-2004 4:05 AM In reply to

    Startup of service

    You can alway start up the service using a batch file.
    then you cans et the parameters you need on the command line in the file
    • Post Points: 0
  • 02-26-2004 7:19 AM In reply to

    • Pryderi
    • Not Ranked
    • Joined on 02-26-2004
    • New Member
    • Points 5

    Running an installer in a setup project

    Add a custom action in the setup project under "Installer" "Commit" "Rollback" and "Uninstall"
    Set this to the project output or assembly which you have your installer in.
    Make sure that the properties for the custom action that InstallerClass is set to true.
    It should then run the service installer when you run the installation to install/uninstall.
    Worked ok for me anyway.
    • Post Points: 0
Page 1 of 7 (103 items) 1 2 3 4 5 Next > ... Last »