Try using a predefined chunk size and read the file by chunks of data. Then you can use data from each chunk and use it. If you need to post the entire file as Base64, reading it by chunks will not change the fact it is too long, if that's the problem.
int chunkSize = 1024;
string source = @"file.accdb";
BinaryReader rdr = new BinaryReader(new FileStream(source, FileMode.Open));
int streamLength = (int)rdr.BaseStream.Length;
while (rdr.BaseStream.Position < rdr.BaseStream.Length)
{
byte[] b = new byte[chunkSize];
long remaining = rdr.BaseStream.Length - rdr.BaseStream.Position;
if(remaining >= chunkSize)
{
rdr.Read(b, 0, chunkSize);
}
else
{
rdr.Read(b, 0, (int)remaining);
}
string chunkString = Convert.ToBase64String(b);
// .. do something with the chunk of data, write to a stream, etc
}
EDIT: I've tested this in your scenario, read the Wildlife video that you get with default windows installation with chunks and wrote them to a file with bytes, and also using Base64 encoded string like you are doing, both tests were OK, and I could play back the video without a problem in both cases, so the method of reading shouldn't be the problem here. I've supplied the method I used for the test. If the problem still persists, try uploading a small file and verify the sent contents match what your web service is getting and saving. I think that the problem might be what I described in the comment below, the hint that C# and Java treat Base64 a bit differently.
StringBuilder acc = new StringBuilder();
int chunkSize = 2187;
string source = @"Wildlife.wmv";
BinaryReader rdr = new BinaryReader(new FileStream(source, FileMode.Open));
while (rdr.BaseStream.Position < rdr.BaseStream.Length)
{
byte[] b = new byte[chunkSize];
long remaining = rdr.BaseStream.Length - rdr.BaseStream.Position;
if (remaining >= chunkSize)
{
rdr.Read(b, 0, chunkSize);
}
else
{
rdr.Read(b, 0, (int)remaining);
}
acc.Append(Convert.ToBase64String(b));
}
FileStream fs = new FileStream(@"c:\dev\test.wmv", FileMode.OpenOrCreate);
fs.Write(Convert.FromBase64String(acc.ToString()),0,0);
Process.Start(@"c:\dev\test.wmv");