473,388 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Small windows service error - No public installers with the RunInstallerAttribute.Yes

365 100+
wrote small service send a command when system is ON and when system is OFF, when I install below command, getting error "No public Installers with the RunInstallerAttribute.Yes

c:> InstallUtil.exe /i myService.exe

Looking for simple service for OnStart() and OnStop()
Mar 6 '12 #1
2 8197
PsychoCoder
465 Expert Mod 256MB
You need to create an installer, read through this
Mar 7 '12 #2
tvnaidu
365 100+
Thanks, I did follow, but still issue when PC Power ON, I want to send command when Turn ON PC and also when turn Off PC, It sends when it is OFF, but it doesnot send when PC is power ON, any issues

Expand|Select|Wrap|Line Numbers
  1.  
  2. using System;
  3. using System.IO;
  4. using System.IO.Ports;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Diagnostics;
  9. using System.Linq;
  10. using System.ServiceProcess;
  11. using System.Text;
  12. using System.Threading;
  13.  
  14. namespace projectorServ
  15. {
  16.     public partial class Service1 : ServiceBase
  17.     {
  18.         public Service1()
  19.         {
  20.             InitializeComponent();
  21.             this.CanShutdown = true;
  22.         }
  23.  
  24.         protected override void OnStart(string[] args)
  25.         {
  26.             //StreamWriter log = new StreamWriter("c:\\TEMP\\ServiceLog-start.txt");
  27.             //log.WriteLine("Shuting down service - VT");
  28.             //log.Flush();
  29.             //log.Close();
  30.             Thread worker = new Thread(DoWork);
  31.             worker.Name = "MyStartThread";
  32.             worker.IsBackground = false;
  33.             worker.Start();
  34.  
  35.         }
  36.  
  37.         void DoWork()
  38.         {
  39.             string command = "\x0002PON\x0003"; //"\x0002POF\x0003";
  40.  
  41.             SerialPort COM1 = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
  42.  
  43.             COM1.ReadTimeout = 2000;
  44.             COM1.Open();
  45.  
  46.             COM1.WriteLine(command);
  47.  
  48.             COM1.Close();
  49.  
  50.         }
  51.  
  52.         protected override void OnStop()
  53.         {
  54.             string command = "\x0002POF\x0003"; //"\x0002POF\x0003";
  55.  
  56.             SerialPort COM1 = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
  57.  
  58.             COM1.ReadTimeout = 2000;
  59.             COM1.Open();
  60.  
  61.             COM1.WriteLine(command);
  62.  
  63.             COM1.Close();
  64.  
  65.         }
  66.  
  67.         protected override void OnShutdown()
  68.         {
  69.             //StreamWriter log = new StreamWriter("c:\\TEMP\\ServiceLog-stop.txt");
  70.             //log.WriteLine("Shuting down service - VT");
  71.             //log.Flush();
  72.             //log.Close();
  73.             ////handler.StopServiceHandler();
  74.             string command = "\x0002POF\x0003"; //"\x0002POF\x0003";
  75.  
  76.             SerialPort COM1 = new SerialPort("COM1", 19200, Parity.None, 8, StopBits.One);
  77.  
  78.             COM1.ReadTimeout = 2000;
  79.             COM1.Open();
  80.  
  81.             COM1.WriteLine(command);
  82.  
  83.             COM1.Close();
  84.  
  85.  
  86.  
  87.         }
  88.  
  89.         //CanHandlePowerEvent = true;
  90.         //protected override void OnPowerEvent()
  91.         //{
  92.         //}     
  93.  
  94.     }
  95. }
  96.  
  97.  
Mar 7 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: mary | last post by:
I created a windows service, it compiled and installed and started without error on my own (winXP) machine On any other machine, it installs without error, but I get "Error 193: 0xc1 Could not start...
0
by: Jason | last post by:
Hi I have built a windows service in C#, but i get this error when i run the service. it does it's job the first time round, but then pops up this error in the application log. I have service...
5
by: Richard Steele | last post by:
I have created a WinForm application that needs to be run as a windows service (the PC is inaccesible by any user) i have successfully installed the application as a windows service. When i start...
1
by: benmorganpowell | last post by:
I have a small windows service which connects to a POP3 server at defined intervals, scans the available messages, extracts the required information and inserts the data into a SQL database. I am...
0
by: Yueming | last post by:
Hello, I am using Visual Studio .NET 2003 (7.1) C++ on Windows XP. I created a project using Windows Service (.NET). I used all the default except my project name. After the project is...
11
by: tshad | last post by:
I have a small Windows Service program that just has a timer on it and it built fine. I try to install it using InstallUtil and I get the following message: ...
2
by: russ.haley | last post by:
I have created a small windows service in C# that installs using the service installer classes and a deployment project. I have been able to install the service but the uninstallation does not...
10
by: dermot | last post by:
I have wrriten a small windows service application in visual studio ..net 2003 which listens for incoming FTP files. These files would overwrite over time due to duplicate file names. However any...
1
by: DotNation | last post by:
Hi, I m getting following error while starting windows service,and service stops working. "The Visual Basic Development Environment can't provide multiple instances of a single use ...
7
by: d.s.stevenson | last post by:
Hi, I have the following code running as a windows service, but it just won't work... trying to run the service as 'adminuser', and i have made sure it logs on as 'adminuser' in the Services...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.