IOException: 文件“D:\Repo\dotNet\FileSyncTest\log\202412.csv”正由另一进程使用,因此该进程无法访问此文件。 StackTrace: 在 System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 在 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, Boolean useLongPath, Boolean checkHost) 在 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 在 System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) 在 System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) 在 System.IO.StreamWriter..ctor(String path, Boolean append) 在 __ScriptExecution.__ro6xui8a.<>c__DisplayClass0_0.<Exec>g__FileOperation|3(String taskID, String operation, String sourceFile, String targetPath) 在 __ScriptExecution.__ro6xui8a.<>c__DisplayClass0_0.<Exec>g__SyncDirectory|2(DataRow task) 在 __ScriptExecution.__ro6xui8a.<>c__DisplayClass0_1.<Exec>g__callback|4(Object obj) 在 System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 在 System.Threading.TimerQueueTimer.CallCallback() 在 System.Threading.TimerQueueTimer.Fire() 在 System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() 在 System.Threading.ThreadPoolWorkQueue.Dispatch()