サービスを作成しましたが、サービスが行うことは、xml ファイルに情報を書き込むことです。
ほとんどの場合、予定外の再起動で発生するようですが、使用されているファイルが「ロック」されているため、サービスを開始できません。このエラーは、サービスが「自動開始」に設定されているため、システムがまだ起動しているときに発生します。
これはWindows 2003の下にあります。
なぜこれが起こっているのか知っている人はいますか?
ありがとう。
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)