[问题]streamwriter不能writer!!
我看了《通过压缩SOAP改善XML Web service性能》后,觉得蛮不错,就想尝试一下,可是在最后运行的时候在下面这个函数遇到问题
private void Compress(SoapMessage message)
{
if(message is SoapServerMessage)
{
newStream.Position = 0;
StreamReader reader = new StreamReader(newStream);
StreamWriter writer = new StreamWriter(oldStream);
string UnCompressedString = reader.ReadToEnd();
string CompressedString = MyZipLib.Zip.Deflate(UnCompressedString);
writer.WriteLine(CompressedString);
writer.Flush();
}
}
主要问题是此时oldStream的类型为System.Web.Services.Protocols.SoapExtensionStream,但是其Length和Position属性都为 error: an exception of type: {System.NotSupportedException} occurred,从而造成字符串根本写不到oldStream中去
我单步调试过,确实是写不进去,请问如何解决?