【发布时间】:2022-01-06 18:00:24
【问题描述】:
多个读/写操作是访问单个文件,而在写操作时我遇到了这个问题
The process cannot access the file because it is being used in another process
使用它向文件中添加文本
using (StreamWriter writer=System.IO.File.AppendText("wwwroot/Files/file.txt"))
{
writer.WriteLine(stringData.ToString());
writer.Close();
}
是否可以对文件执行多次读/写?
谢谢
【问题讨论】:
标签: c# .net .net-core asp.net-core-webapi .net-core-2.2