변경, 생성 및 삭제를 위해 몇 가지 폴더를 감시하는 Windows 서비스에서 작업하고 있습니다. 사소한 변경을 위해 단일 파일 (구성 설정이있는 XML 파일)을 감시하는 하나의 감시자를 제외하고는 모두 잘 작동합니다.FileSystemWatcher 변경된 이벤트가 변경되지 않았습니다.
Windows 서비스 코드를 가져 와서 파일 시스템 감시자를위한 시작/중지 버튼이있는 간단한 Windows 응용 프로그램에 넣고 시도해 보았습니다. XML 구성 파일의 파일 변경을 감지하지 못합니다. 변경 사항이 실제로 발생하고 파일의 "수정 된 날짜"가 업데이트 중입니다.
XmlEventReferences = New System.IO.FileSystemWatcher()
XmlEventReferences.Path = "C:\XmlReferences\"
XmlEventReferences.Filter = "*.xml"
XmlEventReferences.NotifyFilter = IO.NotifyFilters.FileName
AddHandler XmlEventReferences.Changed, AddressOf ReloadEventReferences
AddHandler XmlEventReferences.Created, AddressOf ReloadEventReferences
AddHandler XmlEventReferences., AddressOf ReloadEventReferences
XmlEventReferences.EnableRaisingEvents = True
코드의 일부이고 이것은 XML 파일의 샘플 즉 :
<EventReference>
<ER_EL_NUMBER>1</ER_EL_NUMBER>
<ER_SEND_TO_DATABASE>true</ER_SEND_TO_DATABASE>
<ER_ACTIVATE_ALARM>true</ER_ACTIVATE_ALARM>
<ER_DESCRIPTION />
</EventReference>
감사합니다. 도움을 주셔서 감사합니다. – Paxenos