471,342 Members | 1,735 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,342 software developers and data experts.

What's missing in this service?

I've followed the section on MSDN on how to
create a service but it seems that when i
install it, i get an error about an
attribute named RunInstallerAttribute.Yes
missing.

As far i haven't seen any info on that for
a basic case of a service. Where should it
go and what does it look like?

namespace MySpace
{
class ServiceRunner : ServiceBase
{
ServiceRunner()
{
this.ServiceName = "PageroLink";
this.CanStop = true;
this.CanPauseAndContinue = true;
this.CanShutdown = true;
this.CanHandlePowerEvent = false;
}
public static void Main()
{
ServiceBase.Run(new ServiceRunner());
}
protected override void OnStart(string[] args)
{
Console.WriteLine("Service commenced.");
}
protected override void OnStop()
{
Console.WriteLine("Service ceased.");
}
}
}
--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #1
4 1575
Hi

The class with the class-level attribute RunInstaller(true) is the installation class for your service.
This is the class responsible for registrering the service(s) with the SCM (Service Control Manager) and writing entries into Registry in Windows.

There is no need to create a custom installer if you do not have special requiremens during the installation process, which I sense you do not.
Add a ordinary installer via your control-designer surface and it will work.

/Claus Konrad
"K Viltersten" <tm**@viltersten.comwrote in message news:6i************@mid.individual.net...
I've followed the section on MSDN on how to
create a service but it seems that when i
install it, i get an error about an
attribute named RunInstallerAttribute.Yes
missing.

As far i haven't seen any info on that for
a basic case of a service. Where should it
go and what does it look like?

namespace MySpace
{
class ServiceRunner : ServiceBase
{
ServiceRunner()
{
this.ServiceName = "PageroLink";
this.CanStop = true;
this.CanPauseAndContinue = true;
this.CanShutdown = true;
this.CanHandlePowerEvent = false;
}
public static void Main()
{
ServiceBase.Run(new ServiceRunner());
}
protected override void OnStart(string[] args)
{
Console.WriteLine("Service commenced.");
}
protected override void OnStop()
{
Console.WriteLine("Service ceased.");
}
}
}
--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.

Sep 3 '08 #2
To add an installer:
Right-click on your service and press "Add Installer". This will add the installer class to your service and this very installer class will carry the RunInstaller(true) attribute for your. You do not need to worry about these things though. Just add the installer and you should be fine...

/Claus Konrad
"K Viltersten" <tm**@viltersten.comwrote in message news:6i************@mid.individual.net...
I've followed the section on MSDN on how to
create a service but it seems that when i
install it, i get an error about an
attribute named RunInstallerAttribute.Yes
missing.

As far i haven't seen any info on that for
a basic case of a service. Where should it
go and what does it look like?

namespace MySpace
{
class ServiceRunner : ServiceBase
{
ServiceRunner()
{
this.ServiceName = "PageroLink";
this.CanStop = true;
this.CanPauseAndContinue = true;
this.CanShutdown = true;
this.CanHandlePowerEvent = false;
}
public static void Main()
{
ServiceBase.Run(new ServiceRunner());
}
protected override void OnStart(string[] args)
{
Console.WriteLine("Service commenced.");
}
protected override void OnStop()
{
Console.WriteLine("Service ceased.");
}
}
}
--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.

Sep 3 '08 #3
On Sep 3, 7:45*am, "K Viltersten" <t...@viltersten.comwrote:
I've followed the section on MSDN on how to
create a service but it seems that when i
install it, i get an error about an
attribute named RunInstallerAttribute.Yes
missing.

As far i haven't seen any info on that for
a basic case of a service. Where should it
go and what does it look like?

namespace MySpace
{
* class ServiceRunner : ServiceBase
* {
* * ServiceRunner()
* * {
* * * this.ServiceName = "PageroLink";
* * * this.CanStop = true;
* * * this.CanPauseAndContinue = true;
* * * this.CanShutdown = true;
* * * this.CanHandlePowerEvent = false;
* * }
* * public static void Main()
* * {
* * * ServiceBase.Run(new ServiceRunner());
* * }
* * protected override void OnStart(string[] args)
* * {
* * * Console.WriteLine("Service commenced.");
* * }
* * protected override void OnStop()
* * {
* * * Console.WriteLine("Service ceased.");
* * }
* }

}

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Hi,

Right click in the design panel of your service and select Add
Installer.
Then add a setup project to your solution, add the primary output of
your service.
I know there is another step, adding a custom action maybe?? Let me
check ...
Sep 3 '08 #4
The class with the class-level attribute RunInstaller(true) is the installation class for your service.
This is the class responsible for registrering the service(s) with the SCM (Service Control Manager) and writing entries into Registry in Windows.

There is no need to create a custom installer if you do not have special requiremens during the installation process, which I sense you do not.
Add a ordinary installer via your control-designer surface and it will work.

According to
http://msdn.microsoft.com/sv-se/libr...us,VS.80).aspx
i should see [RunInstallerAttribute(true)] and not the
one you mentioned. What's up with that?

--
Regards
Konrad Viltersten
----------------------------------------
May all spammers die an agonizing death;
have no burial places; their souls be
chased by demons in Gehenna from one room
to another for all eternity and beyond.
Sep 3 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Srinivas M | last post: by
3 posts views Thread by Harry Simpson | last post: by
reply views Thread by Mark Shehan | last post: by
3 posts views Thread by musosdev | last post: by
reply views Thread by Jigar.Patel | last post: by
reply views Thread by MSDN | last post: by
7 posts views Thread by Billy Angers | last post: by
2 posts views Thread by huohaodian | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.