Windows services

I need to write a windows service that executes an application after a certain amount of time. I checked the code on MSDN and found an example where the System.ServiceProcess.ServiceBase class is subclassed.

I did the following.

  • created a new C # console application
  • copied the code from the MSDN example
  • Run

I am getting the following error

The type or namespace name "ServiceProcess" does not exist in the namespace "System" (are you missing an assembly reference?)

As I copied the example from MSDN, I have no idea why the code is still not working. This is my first time writing services and I love some of the guidelines.

thnkx!

+2


a source to share


3 answers


Have you included a reference to the System.ServiceProcess namespace in your project? Right click on your project in Solution Explorer and select Add Reference, then find System.ServiceProcess in the list under the .NET tab.



+10


a source


You need to add a link to System.ServiceProcess.dll

in your application. If you go to MSDN , you will see that it tells you which assembly and physical dll is in the class you are looking at.



+10


a source


Did you also know that services used only for planning tasks are quite expensive?

Microsoft always recommends a scheduler for this kind of content. You may have good reasons for this, but I just wanted to say this;)

+6


a source







All Articles