Hi,
I have a WCF web service that returns a stream. At the client side when i try to read it using below code then i get an exception at line " Byte[] buffer = new Byte[outputMessage.FileByteStream.Length];" saying System.Notsupported. Please advise me on what am i doing wrong here.
FileMetaData metaData = new FileMetaData();
metaData.ProductIDsArray = new string[] { "1", "2" };
metaData.AuthenticationKey = "test";
FileDownloadMessage inputParam = new FileDownloadMessage(metaData);
FileTransferServiceClient obj = new FileTransferServiceClient();
FileDownloadReturnMessage outputMessage = obj.DownloadFile(inputParam);
Byte[] buffer = new Byte[outputMessage.FileByteStream.Length];
int byteRead = outputMessage.FileByteStream.Read(buffer, 0, buffer.Length);
Response.Buffer = false;
Response.Buffer = false;
Response.ContentType = "application/x-zip";
Response.AppendHeader("content-length", buffer.Length.ToString());
Stream outStream = Response.OutputStream;
while (byteRead > 0)
{
outStream.Write(buffer, 0, buffer.Length);
byteRead = outputMessage.FileByteStream.Read(buffer, 0, buffer.Length);
}
outputMessage.FileByteStream.Close();
outStream.Close();