Sending big file by webservice and OOM exception
- by phenevo
Hi,
I have webservice, with method:
[WebMethod]
public byte[] GetFile(string FName)
{
System.IO.FileStream fs1 = null;
fs1 = System.IO.File.Open(FName, FileMode.Open, FileAccess.Read);
byte[] b1 = new byte[fs1.Length];
fs1.Read(b1, 0, (int)fs1.Length);
fs1.Close();
return b1;
}
and it works with small file like 1mb, but when it comes to photoshop's file (about 1,5gb) I get:
System.OutOfMemoryException
on this line:
Byte[] img = new Byte[fs.Length];
The idea is I have winforms application which get this file and saving it on local disc.