오늘도이 같은 문제가 발생했으며 WinForms 또는 ASPX에 대한 답변이 내 상황 (실행되지 않는 예약 된 작업 exe)에서는 불가능한 것처럼 보였습니다. 이렇게 : -
protected void prog_Load(object sender, EventArgs e)
{
boolean setupComplete = false;
try // setting an Event log entry, just to see if we can
{
logEvent = "prog started";
EventLog.WriteEntry(logSource, logEvent, EventLogEntryType.Information, 0);
setupComplete = true;
}
catch (Exception eLog1) // we can't, so try to fix
{
try
{
EventLog.CreateEventSource(logSource, logLog);
logEvent = "prog registered for Event Logging";
EventLog.WriteEntry(logSource, logEvent, EventLogEntryType.Information, 0);
}
catch (Exception eLog2) // aha! we probably lack admin rights to set the registry key
{
MessageBox.Show("prog needs admin rights the first time it runs", "prog Setup", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
// run
if (setupComplete == true)
{
DoTheWork();
}
// exit
this.Close();
}
내 응용 프로그램에는 관리자 권한이 필요하지 않습니다. 단지 보안 분기에 읽기 권한이 필요합니다. – Sam
"디자인"에 따른 보안 지사는 관리자 또는 도메인 권한 (읽기 전용)을 가진 사람에게만 허용됩니다. 프로그래밍 방식으로이를 우회하려면 "레지스트리 설정"을 변경해야 할 수도 있습니다. 첨부 된 KB : http://support.microsoft.com/kb/323076 –