2012-07-16 3 views
0

내 응용 프로그램에서 새 EventLog 소스를 만들고 EventLog.SourceExists를 사용하는 라이브러리 (제어 할 수 없음)를 호출합니다. 그것은 던졌습니다 System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.새 이벤트 로그 소스 만들기

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Security에 대한 액세스 권한이 필요합니다. 레지스트리 서비스에 프로그래밍 방식으로 네트워크 서비스 권한을 부여하려면 어떻게해야합니까?

모든 포인터 주셔서 감사합니다.

답변

0

"새 소스"가 등록되어 있지 않으며 관리 권한이 필요하기 때문에이 오류 메시지가 표시됩니다. APP에서 "관리자"로 APP를 실행 해보십시오.

"소스"에 직접 추가하여 "레지스트리"를 해킹 한 적이 있지만 잘못 알고 있습니다.

+0

내 응용 프로그램에는 관리자 권한이 필요하지 않습니다. 단지 보안 분기에 읽기 권한이 필요합니다. – Sam

+0

"디자인"에 따른 보안 지사는 관리자 또는 도메인 권한 (읽기 전용)을 가진 사람에게만 허용됩니다. 프로그래밍 방식으로이를 우회하려면 "레지스트리 설정"을 변경해야 할 수도 있습니다. 첨부 된 KB : http://support.microsoft.com/kb/323076 –

0

오늘도이 같은 문제가 발생했으며 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(); 
    } 
관련 문제