What is the preferred way to retrieve large(approx: 50 MB) xml string from ASP.NET webpage?
Placing the xml string in file and downloading the file is not a choice.(This should be my last resort if nothing else works)
I have following method on ASP.NET server which is exposed through WCF service to silverlight client.
[OperationContract]
public string GetXmlDataByRegion(string region)
{
//Fetch Xml string from database based on given region name
}
Unfortunately these xml strings are approximately 50MB to 100 MB. Silverlight client needs to retrive these large strings and store it in a file on the client machine at the path selected by the user through saveFileDialog.
My concern is WCF service will not allow such large messages. How can I address this issue? Any ideas?
You can do it, you’ll just need to bump up the MaxReceivedMessageSize, maxBufferSize, maxBufferPoolSize, and potentially others – keep bumping them up until you’re successful.
This will permit large files to be sent and received, but you need to open up both ends to expect it.
You can also use a Binary message encoding (if you’re not already), even in Silverlight. This will result in smaller messages than plain text.
For example:
Edit:
Streaming of data may be the more appropriate approach:
http://msdn.microsoft.com/en-us/library/ms731913.aspx
Buffered transfers hold the entire message in a memory buffer until the transfer is complete. A buffered message must be completely delivered before a receiver can read it.
Streamed transfers expose the message as a stream. The receiver starts processing the message before it is completely delivered.