读书人

正由另一进程使用因此该进程无法访问

发布时间: 2012-02-16 21:30:36 作者: rapoo

正由另一进程使用,因此该进程无法访问该文件
FileStream fs = new FileStream(indicator.GetFullFileName(this._DbFolder), FileMode.Open, FileAccess.Read,FileShare.Read);
BinaryReader b= new BinaryReader(fs);

int byteCount = prev.ByteCount;
int startPosition = byteCount * startIndex;

b.BaseStream.Seek(startPosition, SeekOrigin.Begin);
byte[] bs = b.ReadBytes(byteCount);

breader.Close();
fs.Close();


文件流也关闭了啊,而且fileShare也设了Read,问什么还提示这个错误呢

[解决办法]
那个文件是不是有程序正在访问,你没关啊

[解决办法]
fs.Dispose();
[解决办法]

报这个错不一定是这里代码有问题

看看前面代码。。是不是哪里没有关。。。

读书人网 >.NET

热点推荐