FileStream can't access the file because it's being used by another process

大兔子大兔子 提交于 2019-12-01 21:38:05

From what I can tell, you're opening the file-stream, and then trying to open it again, before you close it.

Initial opening of the file:

FileStream _FileStream = new FileStream(apPath, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);

and

Response.TransmitFile(apPath); 

seems to be trying to open the file again.

I would suggest calling

_FileStream.Close();

before calling TransmitFile.

i have solved this problem by another way

i open Window Task Manager and find that my dll file of my project is running

multiples ( i mean copy of it exists) i remove them and than my problem is solved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!