File Upload Issue

  • Thread starter Robert Strickland
  • Start date
R

Robert Strickland

Our application uploads a file to go through some parsing. Towards the end
of the process, the application moves the file from the 'processing' folder
to an archive location. However, at times this move (a moveto) fails because
the file is in use by another process (we receive a System.IO.IOException).
This DOES NOT happen on every upload. Using the FileMon tool from
SysInternals, I viewed the process activity on any file dropped into the
processing folder. I found the w3wp.exe process (this is a Windows 2003
server) working on the uploaded file. Below are the last two event captures
for a single uploaded file.

1:01:20 PM w3wp.exe:2116 READ
D:\AT.File\AT.BatchWatchFiles\WatchDogDrop\Test Batch
File-3381829280.00969.csv SUCCESS Offset: 0 Length: 4096
1:06:06 PM w3wp.exe:2116 CLOSE
D:\AT.File\AT.BatchWatchFiles\WatchDogDrop\Test Batch
File-3381829280.00969.csv SUCCESS

As you can see, I have the last read statement (there is plenty more before
this read) and the close statement both from w3wp.exe. There is over 4
minutes between the two. However, I have seen the CLOSE execute within the
same second of the last read. Through my testing, the 4 minute delay is
unusally - any delay is in the 30 to 45 second range.

Is this normal processing for the Asp.Net file upload. Why does the CLOSE
occur right after the read on most uploads but for a few uploads the CLOSE
takes up to 4 minutes to execute? Do I need to check if there is any other
process or activity that has the file locked?

Thanks
 
G

George Ter-Saakov

Are you sure you closing file yourself?
do not rely ongarbage collector. Always close it. Even if exception has
happened you still must close.

something like

try
{
open file......
......Do the Dew....
}
finally
{
close file
}

George
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,818
Latest member
Brigette36

Latest Threads

Top