问题描述:

I have done a small Webapi that exposes a POST action. I have created a custom MultipartFileStreamProvider to deal with the payload and store the files. The problem occurs when I send a huge amount of files ( more precisely sending 1500 files one at a time sequentially). In my override method ExecutePostProcessingAsync I have the following line that try to read the file

using (var fs = new FileStream(file.LocalFileName, FileMode.Open, FileAccess.Read, FileShare.Read))

but It throws an IOException

"The process cannot access the file"

for very few of them(usually one or two files out of 1500). I have no idea who has a lock on it (probably IIS or asp.net)

Any advises ( I can probably add a some retry after 10ms but would like to have a proper understanding of what is going wrong and how to properly handled these files uploads)

相关阅读:
Top