469,626 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Stream not readable problem

hs
Hi

I got a 'stream not readable' exception. I'd appreciate if some one can tell
me how i can overcome this.

thanks
My Exception
--------------
An unhandled exception of type 'System.Web.Services.Protocols.SoapException'
occurred in system.web.services.dll

Additional information: System.Web.Services.Protocols.SoapException: Server
was unable to process request. ---> System.ArgumentException: Stream was not
readable.
at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean
detectEncodingFromByteOrderMarks, Int32 bufferSize)
at System.IO.StreamReader..ctor(Stream stream)
at WebService1.Service1.GetCompressedData() in
c:\inetpub\wwwroot\webservice1\service1.asmx.cs:li ne 114
--- End of inner exception stack trace ---

My code
---------
[WebMethod]
public string GetCompressedData()
{
TextReader textreader;
DataSet ds = new DataSet();

// populate dataset
....

byte[] bytes = System.Text.Encoding.UTF8.GetBytes(ds.GetXml());

// compress using
using(MemoryStream sourcestream = new MemoryStream(bytes))
{
MemoryStream destinationStream = new MemoryStream();
using (XceedCompressedStream xcs =
new
XceedCompressedStream(destinationStream))
{
byte[] buffer = new byte[ 32768 ];
int bytesRead = 0;

while( ( bytesRead = sourcestream.Read( buffer, 0, buffer.Length ) )
0 )

{
xcs.Write( buffer, 0, bytesRead );
}
}
textreader = new StreamReader(destinationStream); // **** line 114 ****
}
return textreader.ReadToEnd();
}
Jul 19 '05 #1
0 5738

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Alfred | last post: by
5 posts views Thread by dbuser | last post: by
1 post views Thread by Ryan Ternier | last post: by
4 posts views Thread by Jack Russell | last post: by
reply views Thread by hs | last post: by
reply views Thread by =?Utf-8?B?TWFya3VzU3Ryb2Js?= | last post: by
9 posts views Thread by fevos | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.