매우 실망한 문제가 있습니다. 나는 TCPServer와 같은 역할을하는 Windows 서비스를 작성하고있다. (나는 기술적 인 용어에 대해 잘 모르지만 서비스는 클라이언트 사이의 TCP를 통한 통신을 처리한다.)catch (예외)를 사용할 때 Windows 서비스의 처리되지 않은 예외
내 문제는 서비스가 무작위로 충돌 (적어도 나는 예외가 발생 모르겠어요) 및 Windows 응용 프로그램 로그가 말하는 VsJITDebugger (이벤트 ID 4096) 오류 메시지가 포함되어 있습니다 :
An unhandled win32 exception occurred in SDUNoteTCPServerService.exe [1028]. Just-In- Time debugging this exception failed with the following error: Debugger could not be started because no user is logged on.
내가 VsJITDebugger가 100 % 확실한 것은 아니지만 VsJITDebugger를 검색하여 알 수있는 한 Visual Studio를 사용하여 처리되지 않은 예외를 설명하는 도구입니다. 단지 VsJITDebugger 오류 메시지 전에 오류 메시지 : 때때로 나는 또한 다음과 같은 닷넷 런타임 (1026 이벤트 ID를) 참조 나는 세부 사항을 작성하려고 할 때 처리되지 않은 오류가 발생 닷넷 런타임 오류 메시지에 명시된 바와 같이
Application: SDUNoteTCPServerService.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ComponentModel.Win32Exception Stack: at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32, UInt16, System.Diagnostics.EventLogEntryType, System.String[], Byte[], System.String) at System.Diagnostics.EventLogInternal.WriteEntry(System.String, System.Diagnostics.EventLogEntryType, Int32, Int16, Byte[]) at System.Diagnostics.EventLog.WriteEntry(System.String, System.Diagnostics.EventLogEntryType, Int32) at TCPServer.TCPServerListener+AsynchronousSocketListener.WriteCustomSocketObjectMessagesToLog (System.String, System.Diagnostics.EventLogEntryType, Int32) at TCPServer.TCPServerListener+CustomSocketObject.SendMessageToClientThread() at System.Threading.ThreadHelper.ThreadStart_Context(System.Object) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean) at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object) at System.Threading.ThreadHelper.ThreadStart()
EventLog에 잡힌 예외에 대한 정보. 예외는 이며 소켓의 BeginReceive 메서드의 콜백 함수에서 항상이 throw됩니다.
Socket.BeginReceive 메서드의 콜백 함수에서 try {} catch (Exception)를 사용하여 일반 예외를 catch하고 있기 때문에이 예외가 서비스를 중단시키는 이유를 알지 못합니다. 처리되지 않은 예외가 던져지기 때문에 catch 된 예외에 대한 정보를 추출하십시오.
어떤 아이디어가 문제 일 수 있습니까? 모든 답장을 환영합니다.
참고 : 서비스는 Windows Server 2003 (SP2)에서 실행됩니다. Visual Studio 2008이 설치됩니다.
편집은 다음 WriteCustomSocketObjectMessagesToLog는 (이벤트 로그 객체가 AsynchronousSocketListener 클래스의 속성입니다) 다음과 같습니다
private void WriteExceptionToLog(string customstartmessage, Exception ex) { try { eventlog.WriteEntry(customstartmessage, EventLogEntryType.Error); eventlog.WriteEntry(ex.Message, EventLogEntryType.Error, 5); eventlog.WriteEntry(ex.Source, EventLogEntryType.Error, 5); eventlog.WriteEntry(ex.StackTrace, EventLogEntryType.Error, 5); } catch (Exception) { eventlog.WriteEntry("Failed reporting exception", EventLogEntryType.Error); } }
편집 2 :
나는 문제가 무엇인지 알아 냈어. 이벤트 로그 전체가보고됩니다. 당연히 나는 그것에 글을 쓸 수 없다. 클래스 라이브러리를 콘솔 응용 프로그램으로 변환하여 문제를 발견했습니다. TCPServer 클래스를 쓰기 시작했을 때도이 작업을 수행했지만 그때는 WriteLine 메서드를 사용하여 Console에 오류를 기록했습니다. 이번에는 콘솔 응용 프로그램이 생성 된 이벤트 로그에 쓰고 처리되지 않은 예외가 콘솔에 기록됩니다 (이 작업을 수행하지 않았기 때문에 콘솔 응용 프로그램의 기본 동작 인 경우에는 그렇지 않습니다).
Unhandled Exception: System.ComponentModel.Win32Exception: The event log file is full at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) at System.Diagnostics.EventLog.WriteEntry(String message) at TCPServer.Program.Main(String[] args)
지금 난 그냥 아마이 문제를 처리 할 필요가 : 내 Windows 서비스에서 처리되지 않은 오류가 아마 이것이다. 이 오류를 처리하는 더 좋은 해결책은 무엇입니까? 오류가 발생할 때마다 이벤트 로그를 프로그래밍 방식으로 저장하고 비 웁니다. eventlog 크기를 무제한으로 늘리십시오 (이것이 가능하고 좋은 생각입니까?)? 다른 제안?
서비스가 실행중인 계정에 원하는 위치에서 디스크에 쓸 수있는 권한이 있습니까? – Heslacher
Crystal Ball은 Windows 이벤트 로그에 이벤트를 기록하려고 할 때 catch 처리기가 충돌하고 있다고 말합니다. 확실한 이유가 무엇인지, 당신은 왜 충돌하는지 알지 못합니다. 해당 컴퓨터에서 디버거를 쉽게 얻을 수없는 경우 DebugDiag와 같은 도구를 사용하십시오. –
관리자 권한이있는 계정으로 서비스가 실행되는 시점에서 권한이 문제가 아니지만 다시는 100 % 확신 할 수 없다고 가정합니다. –