VB.Net File.Copy Conundrum

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.

I have a VB.Net program that copies a file from one server to another server.
This program has been working without any problems for about a year.
A couple of weeks ago the "server from" crashed and had to be rebuilt.
Now, when the File.Copy method in the VB.Net program is executed an error
occurs about 90% of the time, always with a larger file.

Here's the line of code:
File.Copy(sFileName, sDistributionPathFile)

Is there some timeout property somewhere that needs to be set to resolve
this issue? When first setting up this program I don't recall having to do
this.

TIA.

Rita
 
RitaG said:
Hello.

I have a VB.Net program that copies a file from one server to another
server.
This program has been working without any problems for about a year.
A couple of weeks ago the "server from" crashed and had to be rebuilt.
Now, when the File.Copy method in the VB.Net program is executed an error
occurs about 90% of the time, always with a larger file.

Here's the line of code:
File.Copy(sFileName, sDistributionPathFile)

Is there some timeout property somewhere that needs to be set to resolve
this issue? When first setting up this program I don't recall having to do
this.

TIA.

Rita

What is the exception you are receiving.? I am not sure if there are any
time outs for a file.copy. Is this a asp.net or winform application. If
it is asp.net then you could be getting a time out from the request time
out. If it is winform or console there should not be a time out.

jjardine
 
Hi James.

Thanks for your response. The program is a Windows Application.
The File.Copy is within a Try statement but I dont actually check the
exception.

Try
File.Copy(sDestinationPathFileQA, sDistributionPathFile)
Catch e As Exception
sStr = "Error copying file (" & sDestinationPathFileQA & _
") to distribution server("& sDistributionPathFile & ")"
......

I will change the Catch routine to check the error message.
Thanks for that!

Rita
 
RitaG said:
Hi James.

Thanks for your response. The program is a Windows Application.
The File.Copy is within a Try statement but I dont actually check the
exception.

Try
File.Copy(sDestinationPathFileQA, sDistributionPathFile)
Catch e As Exception
sStr = "Error copying file (" & sDestinationPathFileQA & _
") to distribution server("& sDistributionPathFile & ")"
......

I will change the Catch routine to check the error message.
Thanks for that!

Rita

What operating systems are the two machines running. Also what version of
..net are you using?
 
Back
Top