G
Guest
Hi All, I'm experiencing troubles in a simple .net web application. The
applicatione is made up by a single form looping to move some files to a
different folder .
the main loop is as follows :
C
Const CurrUploadDir= .....
Const CurrSentDir= .....
Dim CurFile as string
CurFile = Dir(CurrUploadDir & "*.*")
Do While CurFile <> ""
If Not (GetAttr(CurrUploadDir & CurFile) And vbDirectory) =
vbDirectory Then
..... missing instructions
FileCopy(CurrUploadDir & CurFile, CurrSentDir & CurFile)
Kill(CurrUploadDir & CurFile)
..... missing instruction
End If
CurFile = Dir()
Wend
The copy Statement fails because the Source file "is being used by another
process"
None of the missing instruction works on the Source File of the copy
statement.
The same operation succeeds if performed from the SysOp prompt or from the
Explorer GUI
Monitoring the file activity during debug with a tool from Sysinternals I
cannot see processes other aspnet_wp accessing the file. ..
The following lines relate to the FILECOPY instruction execution .... they
reveals an ACCESS SHARING VIOLATION probably because the first OPEN has not
been closed when the second starts ...
17.12.32 aspnet_wp.exe:776 OPEN SUCCESS Options: Open
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 CLOSE SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
Where m'I wrong ? How can I detect who is locking the file ? Any suggestion
will be appreciated . Thanks in advance Daniele Balducci
applicatione is made up by a single form looping to move some files to a
different folder .
the main loop is as follows :
C
Const CurrUploadDir= .....
Const CurrSentDir= .....
Dim CurFile as string
CurFile = Dir(CurrUploadDir & "*.*")
Do While CurFile <> ""
If Not (GetAttr(CurrUploadDir & CurFile) And vbDirectory) =
vbDirectory Then
..... missing instructions
FileCopy(CurrUploadDir & CurFile, CurrSentDir & CurFile)
Kill(CurrUploadDir & CurFile)
..... missing instruction
End If
CurFile = Dir()
Wend
The copy Statement fails because the Source file "is being used by another
process"
None of the missing instruction works on the Source File of the copy
statement.
The same operation succeeds if performed from the SysOp prompt or from the
Explorer GUI
Monitoring the file activity during debug with a tool from Sysinternals I
cannot see processes other aspnet_wp accessing the file. ..
The following lines relate to the FILECOPY instruction execution .... they
reveals an ACCESS SHARING VIOLATION probably because the first OPEN has not
been closed when the second starts ...
17.12.32 aspnet_wp.exe:776 OPEN SUCCESS Options: Open
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 OPEN SHARING VIOLATION
17.12.32 aspnet_wp.exe:776 CLOSE SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
17.12.32 aspnet_wp.exe:776 QUERY INFORMATION SUCCESS
Where m'I wrong ? How can I detect who is locking the file ? Any suggestion
will be appreciated . Thanks in advance Daniele Balducci