看板 C_Sharp 關於我們 聯絡資訊
我寫Windows Service程式,程式運作需要用到App.config設定值 因此我用FileSystemWatcher()監控它的變更(有避開會執行3次的問題) 其事件中: ConfigurationManager.RefreshSection("appSettings"); // 不加此行會讀到舊值 string newValue = ConfigurationManager.AppSettings["Value"]; this.ApplyNewValue(newValue); // do something 然而,服務運作時,若修改config檔,它發生例外: "載入組態檔時發生錯誤: 由於另一個處理序正在使用檔案" 請問要如何解決? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ※ 編輯: tomex 來自: 122.146.5.194 (11/14 11:28)
tomex:改用其他的config,存取也發生error,可能是該event已lock住 11/14 13:45