المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Windows Service not Installing



C# Programming
06-11-2009, 02:30 PM
i have created a windows service using VS2005 and installed it using the installutil.exe. I used the following command to install the service:

installutil /name=MyService /user= /password=

After executing this command I get the output as:

The Commit phase completed successfully.

The transacted install has completed.

But still I can not see the service in services.msc window not Can I see any registry entries for this service. I have admin Privilege on my machine.

Any pointers??

PS: I am using following code to create the service:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Collections;
using System.Configuration;
using System.IO;
namespace TestService
{
public partial class myService : ServiceBase
{
public myService()
{
InitializeComponent();
}

protected override void OnStart(string[] args)
{
FileStream fs = new FileStream(@"c:\temp\mcWindowsService.txt",
FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(" mcWindowsService: Service Started \n");
m_streamWriter.Flush();
m_streamWriter.Close();
}
///
/// Stop this service.
///
protected override void OnStop()
{
FileStream fs = new FileStream(@"c:\temp\mcWindowsService.txt",
FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(" mcWindowsService: Service Stopped \n"); m_streamWriter.Flush();
m_streamWriter.Close();
}

}
}