I created a service and what it does is writing information into a xml file.
Sometime, it seem to happen mostly with unscheduled reboot, the service cannot start because the file used is "locked". This error happen while the system is still starting up since my service is set to "auto start".
This is under windows 2003.
Anyone know why this is happening?
thanks.
The process cannot access the file 'D:\myService\eventlog.xml' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding)
at System.Data.DataTable.WriteXml(String fileName, XmlWriteMode mode, Boolean writeHierarchy)
at System.Data.DataTable.WriteXml(String fileName)
at myService.c_control.addXmlLog(eventStatus timeStatus)