Note that there are some explanatory texts on larger screens.

plurals
  1. POInstalling a .net 2008 windows service
    text
    copied!<p>I just created a simple test Windows Service and am having trouble. I'm new to Windows Services so I don't know if I'm even doing this right.</p> <pre><code>namespace testWindowsService { public partial class Service1 : ServiceBase { public Service1() {InitializeComponent();} protected override void OnStart(string[] args) { FileStream fs = new FileStream(@"c:\temp\started.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter m_streamWriter = new StreamWriter(fs); m_streamWriter.BaseStream.Seek(0, SeekOrigin.End); m_streamWriter.WriteLine("Service Started on \n" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString()); m_streamWriter.Flush(); m_streamWriter.Close(); } protected override void OnStop() { FileStream fs = new FileStream(@"c:\temp\stopped.txt", FileMode.OpenOrCreate, FileAccess.Write); StreamWriter m_streamWriter = new StreamWriter(fs); m_streamWriter.BaseStream.Seek(0, SeekOrigin.End); m_streamWriter.WriteLine("Service Stopped \n" + DateTime.Now.ToShortDateString() + " at " + DateTime.Now.ToShortTimeString()); m_streamWriter.Flush(); m_streamWriter.Close(); } } } </code></pre> <p>Then I built the project and opened Command Prompt from Start -> All Programs -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt. From the prompt I ran:</p> <pre><code>installutil C:\Users\myUser\Documents\MyServices\testWindowsService\testWindowsService\bin\Debug\testWindowsService.exe </code></pre> <p>But I get the error:</p> <pre><code>No public installers with the RunInstallerAttribute.Yes attribute could be found in the C:\Users\myUser\Documents\MyServices\testWindowsService\testWindowsService\bin\Debug\testWindowsService.exe assembly. </code></pre> <p>I've tried googling it but found a lot of dead ends and half answers.</p> <p>Thank you</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload