Ignacio said:
Hi,
I do not think so, IIRC everybody can write in the log
Post your code just to be sure it's correct.
Not at all, the problem should be in something else you are trying to do,
post your code !
I've muched with the code a bit but I was following directions from MSDN
here:
http://msdn.microsoft.com/library/d...kthroughcreatingwindowsserviceapplication.asp
Thanks much
-Aaron
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
namespace MyNewService
{
public class MyNewService : System.ServiceProcess.ServiceBase
{
private System.Diagnostics.EventLog eventLog1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public MyNewService()
{
// This call is required by the Windows.Forms Component Designer.
InitializeComponent();
}
// The main entry point for the process
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
// More than one user Service may run within the same process. To add
// another service to this process, change the following line to
// create a second service object. For example,
//
// ServicesToRun = new System.ServiceProcess.ServiceBase[] {new
Service1(), new MySecondUserService()};
//
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new
MyNewService() };
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.eventLog1 = new System.Diagnostics.EventLog();
((System.ComponentModel.ISupportInitialize)(this.eventLog1)).BeginInit();
//
// eventLog1
//
this.eventLog1.Log = "System";
this.eventLog1.MachineName = "skinner";
((System.ComponentModel.ISupportInitialize)(this.eventLog1)).EndInit();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
/// <summary>
/// Set things in motion so your service can do its work.
/// </summary>
protected override void OnStart(string[] args)
{
eventLog1.WriteEntry("In OnStart");
}
/// <summary>
/// Stop this service.
/// </summary>
protected override void OnStop()
{
eventLog1.WriteEntry("In onStop.");
}
protected override void OnContinue()
{
eventLog1.WriteEntry("In OnContinue.");
}
}
}