March 19th, 2002, 07:36 PM
-
Delete file error: file in use by another process
<i><b>Originally posted by : Rod McAuley (rodm@rpcorp.com)</b></i><br /><br />In windows 2000 advanced server after a file is uploaded from an asp.net form it cannot be deleted for several minutes. When an attempt is made to delete the file is responds by saying the file is in use by another process. There are no other programs (that I know of) using that file. After 5 or 10 minutes the file may be deleted. Does anyone know what is going on and how I can delete the file immediately after is uploaded.
January 9th, 2004, 11:32 AM
-
Ever find an answer?
I am having the same issue. Did you ever get your problem resolved?
Please let me know,,, if I find anything I will let you know too.
Thanks,
Brian
January 15th, 2004, 01:41 PM
-
I'm having this same problem in ASP.NET; I am creating a file on the server and later would like to modify or delete and cannot access it. So this is not limited to uploaded files.
I suspect that the ASP runtime is not releasing File resources so they can be garbage collected. Even if you set the handle to the file to Nothing, it still takes a few minutes before you can get delete or write noappend access to the file.
Is there a call, like in Java, where you tell the system to garbage collect the dereferenced objects? Or other solution?
Thanks,
-Martin
September 7th, 2004, 02:48 PM
-
Same problem with ASP, but only on one of 2 servers...
I am having the same problem, and by accident discovered that make making a change to the global.asa file frees up the file and allows it to be overwritten, which stronly suggests that it has something to do with IIS. To make matters worse, I don't have this problem on my development server, only on a staging server, so it's become more difficult to troubleshoot. I've gone over permissions, IIS settings at least a dozen time, and just cannot find a cause... did anyone figure this out?
September 7th, 2004, 03:26 PM
-
I think I found a fix...
The fix actually involves using a different code block. Instead of using the file and directory objects, use the fileinfo and directoryinfo objects.
A sample of the code follows:
**************
dim fi as fileinfo
fi = new fileinfo(PathToFile)
if fi.exsists then
fi.delete()
end if
**************
Let me know if this works for you. I have been using it lately and have not ran into this issue.
January 12th, 2010, 02:45 PM
-
Can't Delete File In Use
That was my first thought to delete the file. It is what we did before with Classic ASP, and it always worked fine. Not sure what the deal is now. The file uploaded just fine. Then the process opened it up to read the file. I was in debugging the process, when it crapped out. Now I cannot access the file again, until after rebooting.
What is up Microsoft? Why would the file remain in use after an FILE.OPENTEXT? I can't close it now, because it is not open, but your crazy tools and OS says it is. Only option is to come up with a new name and try again. This could be costly on storage space to build processes like this to avoid "File in Use" problems.
Follow-up: The process was actually able to delete the file after waiting the 15 minutes it took to register here and create this posting.
Follow-up 1.5 hours later: Spoke too soon. Now I have a file that has been sitting there for over an hour, and it cannot be deleted by the process that created it and essentially owns it. It is the only program that ever used it.
Last edited by Computer Wizard; January 12th, 2010 at 04:04 PM.
Reason: Typo
January 12th, 2010, 05:36 PM
-
Without code to look at it is hard to tell what/where the problem could be.
When you create the file, are you destroying any object that creates/reads the file when it is finished with it ie set objFile = nothing?
January 12th, 2010, 06:33 PM
-
Access to Microsoft Code
Nothing? Isn't that old school? Wish I could work the old FileSystrem Object in dot Net. It had EOF. Now you have to look for nothing to find the end of the stream.
FYI, I am using ASP/VB.Net File Field Control and IO Streams found in the System.IO namespace. Process appears to work OK unless there is a problem like lets say a timeout. By the way, you really should plan for Murphy's Law.
This is what I am doing.
See Upload Example in MSDN:Uploading Files Using the File Field Control
See StreamReader Example in MSDN:How to: Read Text from a File
Please let me know if something has changed? Will Microsoft let you look at their code in anything other than in a disassembly now so you can arrive at your own solution. I am not interested in working through mountains of undocumented assembler.
I try to create fool proof stuff. The solution I have arrived at creates a new file using an incremental dataset, if necessary to work error free; and, it cleans up after itself as it goes. The extra work involved is just a real pain in the ***.
Our old stuff used both ASPUpload and our own routines for Multi-Part binary form Upload with the Classic ASP. This worked for years without a hitch. We were in control of the process. They did not take possession of the file.
FYI, Microsoft the functions required to create your own upload routines were included with VB6/ASP. They are not supported in .Net, which may be one reason why the ASPUpload and ASPJpeg appear to be stuck on Classic ASP.
January 12th, 2010, 07:39 PM
-
Set objFile (or whatever your object is called) = nothing has nothing do with checking the end of a stream and everything to do with releasing an object from memory...
February 22nd, 2012, 11:07 AM
-
Long Path Tool
Just try the "Long Path Tool" software. Go to Google and search for "Long Path Tool". This software can easily solve this type of all errors very easily and quickly.
September 7th, 2012, 10:09 PM
-
Hey!
i solved my own problem similar to you guys , i just dispose the image in the picture box, example:
picturebox.image.dispose()
you may be able to delete that.
CHEERS! NEW HERE