0
System.IO.File.Copy(sourceFilePath, destinationFilePath)

intermittently throws an IOExeception.

The exception says:

Exception Thrown: "System.IO.IOException" in mscorlib.dll.

Additional Information: Insufficient system resources exist to complete the requested service.

I am calling this code on machine A. sourceFilePath is on machine B. destinationFilePath is on machine C.

This issue is not consistently reproducible.

Community
  • 1
  • 1
GoCurry
  • 899
  • 11
  • 31
  • Any patterns as it relates to the size of the files being copied? What I mean is does it happen more often on larger files? Also what is the size (in MB) of files being copied where it does occur? – Igor Apr 26 '16 at 18:34
  • Hi Igor. Based on what I have observed I think the rate of occurrence of the issue definitely correlates the file size. The size of files being copied where this issue occurs is 600 ~ 700 MB. – GoCurry Apr 27 '16 at 00:07
  • `File.Copy` uses the underlying windows API method to execute the copy. I am not sure what the actual implementation actually is but maybe it does not execute the copy in chunks. I would try changing your code around and opening up 2 file streams (1 to read, 1 to write), execute a loop and read and write in chunks until the content has been copied over. – Igor Apr 27 '16 at 01:10
  • Here are some links with code you could try: http://stackoverflow.com/a/1247042/1260204, http://stackoverflow.com/a/6216495/1260204, http://stackoverflow.com/a/230141/1260204, – Igor Apr 27 '16 at 01:17

1 Answers1

0

This is more than likely a memory issue on your machine. I'd start by looking at the size of your paging file.

Karlomanio
  • 344
  • 4
  • 11
  • Thank you Charles. Which machine is likely to have the memory issue? A, B or C? – GoCurry Apr 27 '16 at 00:02
  • I would say it is the one that is throwing the error. It sounds like machine A. That is the one you are executing the code from, correct? – Karlomanio Apr 27 '16 at 16:26