问题如下:     我写了一个日志操作的类.我在windowservice里面调用其方法,出现拒绝访问的异常.但我写了一个winform程序调用其方法.没有出现任何错误.不知是哪里权限出了问题,望高手指点.谢谢.其类如下:public class SysLog
{
private System.Diagnostics.EventLog _Log;
public SysLog()
{
if(!System.Diagnostics.EventLog.SourceExists("LeanIESource"))
{
System.Diagnostics.EventLog.CreateEventSource("LeanIESource","LeanIELog");
}
_Log = new System.Diagnostics.EventLog();
_Log.Source = "LeanIESource";
_Log.Log = "LeanIELog";
}
public bool WriteLog(string strLog)
{
try
{
_Log.WriteEntry(strLog);
return true;
}
catch
{
return false;
}
}
public bool WriteLog(string strLog,LogType _Type)
{
try
{
_Log.WriteEntry(strLog,(System.Diagnostics.EventLogEntryType)_Type);
return true;
}
catch
{
return false;
}
}
public bool ClearLog()
{
try
{
_Log.Clear();
return true;
}
catch
{
return false;
}
}
}