?
Solved

How to write a service with Visual Studio 2005 STD?

Posted on 2008-06-23
7
Medium Priority
?
170 Views
Last Modified: 2013-11-26
HI,

I've seen this article showing how to write a service (http://www.developerfusion.co.uk/show/3441/2/) with some snapshots, but the problem that i have is that i don't have all the options!

When i start a new project, i DON'T have the option WINDOWS SERVICE.  In this article, they don't mention anything about the fact that i wouldn't be able to write a service or not (http://msdn.microsoft.com/en-ca/vstudio/aa700921.aspx)...  

Anyone have this problem other than me?  Is this a limitation of the STANDARD version?

Thanks for the informations
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 2000 total points
ID: 21854193
The only problem that you would have is that the project template is installed with the Standard version, but you should still be able to develop a Windows service, if you had the code.

You didn't mention language, but this is all you get with a C# Windows service:


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
 
namespace WindowsService1
{
    public partial class Service1 : ServiceBase
    {
        public Service1()
        {
            InitializeComponent();
        }
 
        protected override void OnStart(string[] args)
        {
            // TODO: Add code here to start your service.
        }
 
        protected override void OnStop()
        {
            // TODO: Add code here to perform any tear-down necessary to stop your service.
        }
    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21854197
You will need to add a reference to the System.ServiceProcess.dll to your project.
0
 
LVL 10

Author Comment

by:Christian de Bellefeuille
ID: 21857397
I've just noticed that i can create an Empty Project.  Then i can add a "Windows Service" (just like if i add a form)...  and i get some stuff in it.  When i switch to code, i've exactly what you specified (i choosed VB.NET instead of C#).  

I also had the choice to add an installer to let it install the service, and choose how it should start (manual, auto, disabled).

So as far as i see, the pro version doesn't have much more informations available.

I'll investigate a little bit about this subject.  Thanks for your help

Imports System.ServiceProcess
 
Public Class Facilis_Media_SyncIt
 
    Protected Overrides Sub OnStart(ByVal args() As String)
        ' Add code here to start your service. This method should set things
        ' in motion so your service can do its work.
    End Sub
 
    Protected Overrides Sub OnStop()
        ' Add code here to perform any tear-down necessary to stop your service.
    End Sub
 
End Class

Open in new window

0
Quick Start: DOCKER

Sometimes you just need a Quick Start on a topic in order to begin using it.. this is just what you need to know to get up and running with Docker!

 
LVL 10

Author Comment

by:Christian de Bellefeuille
ID: 21859300
Hi TheLearnedOne, i think that i've closed this case a bit too fast!

It doesn't work at all!  I don't know why, but for some reasons after installing the service, i go to the Services in the admin tools, then try to start my service.  0.25 second after i pressed the Start button, it tell me that it can't start in a "timely fashion".  

Usually we get this message when it hang on the "OnStart" for too long... but actually, 0.25 second is quite fast to get this message!

I've noticed that in the Project properties the application type was set to "Windows application".  So i've uninstalled the service, change that to Windows Service, then rebuild and reinstall.  But i got the same problem.

But when i get back again in the project properties after changing the app type to Service (and saved the project), it bring back the "Windows Application" again!

I don't think that i'm the only one to have this problem.  In this article explaining how to write services, look at comment #25 (http://www.devcity.net/Articles/190/4/article.aspx).

I'll call Microsoft to understand what's going on with their stuff...
0
 
LVL 10

Author Comment

by:Christian de Bellefeuille
ID: 21860552
I'm completely mixed up!  I just spoke with Microsoft, and they told me that i would need to upgrade.  They say that 2008 PRO should be able to let me develop Windows Services... but actually, i look at a microsoft page and they say that 2008 STANDARD should do the job (http://www.microsoft.com/products/info/product.aspx?view=22&pcid=6a94862a-9763-42db-a530-7b5c7353fbe7&crumb=catpage&catid=515c9859-958b-4433-b4f9-91f37258ca2f)

"Build software for Windows:
Develop with the Windows APIs or .NET Framework using the same tools to build Windows services, applications, utilities, games, or business applications."

I'll just give up... i'm not paying anything else.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21861493
Do you still need help?
0
 
LVL 10

Author Comment

by:Christian de Bellefeuille
ID: 21861521
no, thanks.   I've deleted the code i've done so you can't even try what i've written  But i'm sure that Microsoft did that on purpose and my code was correct.  The only way to write a service in the Standard Edition is to write it in C++.

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question