Results 1 to 8 of 8

Thread: How to convert a windows app to windows service?

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2004
    Posts
    29

    How to convert a windows app to windows service?

    I have an application written in vb.net 2008, and I want to convert this to a windows service. It does have an interface, but only to start/stop the application timer, and display a log. What are the steps to convert this into a windows service?

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: How to convert a windows app to windows service?

    Are you using the express edition of 2008 or do you have a version you paid for? I know that professional and above come with a template to create a service. You can use that template as a base, to understand how a service is created. Once you do that, you can take the code that is created and integrate it into your app. If I recall correctly, it is just a special interface that gets implemented and then you use installutil to install the service.

  3. #3
    Fanatic Member
    Join Date
    Dec 2009
    Posts
    595

    Re: How to convert a windows app to windows service?

    Name:  Untitled.png
Views: 1529
Size:  21.6 KB
    How to solve this?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to convert a windows app to windows service?

    Quote Originally Posted by Tommy.net View Post
    Name:  Untitled.png
Views: 1529
Size:  21.6 KB
    How to solve this?
    As the error message suggests, you cannot run a service in the debugger. You have to install it, run it and then attach a debugger to it.

    http://www.google.com.au/search?q=de...ient=firefox-a
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to convert a windows app to windows service?

    As a note, one of the guys I used to work with found a creative way to deal with this issue of debugging services. He created a Console Application project, modified it to run as a service and then he was able to debug it as a console app in VS but then install it to run as a service in production. I'm not exactly sure how he did it and whether there were any issues but I really should look into that. I've never had to create a service myself so I've never bothered before.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: How to convert a windows app to windows service?

    I like to use the Debugger.Launch method in my code, which will prompt you to select a debugger to use for the code.

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2004
    Posts
    29

    Re: How to convert a windows app to windows service?

    Quote Originally Posted by Negative0 View Post
    Are you using the express edition of 2008 or do you have a version you paid for? I know that professional and above come with a template to create a service. You can use that template as a base, to understand how a service is created. Once you do that, you can take the code that is created and integrate it into your app. If I recall correctly, it is just a special interface that gets implemented and then you use installutil to install the service.
    I have VS 2008 Professional.

  8. #8
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: How to convert a windows app to windows service?

    Then you have a service template. Create a new service project and then see how the code works. As I stated, it is not that complex, so you should be able to take that and get going. Basically, your OnStart method is your main entry point to the application.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width