I am using the following code to attempt to read a large file (280Mb) into a byte array from a UNC path
public void ReadWholeArray(string fileName, byte[] data)
{
    int offset = 0;
    int remaining = data.Length;
    log.Debug("ReadWholeArray");
    FileStream stream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
    while (remaining > 0)
    {
        int read = stream.Read(data, offset, remaining);
        if (read <= 0)
            throw new EndOfStreamException
                (String.Format("End of stream reached with {0} bytes left to read", remaining));
        remaining -= read;
        offset += read;
    }
}
This is blowing up with the following error.
System.IO.IOException: Insufficient system resources exist to complete the requested 
If I run this using a local path it works fine, in my test case the UNC path is actually pointing to the local box.
Any thoughts what is going on here ?
 
     
     
     
    