[问题]streamwriter不能writer!!

pencil001 pencil001 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我看了《通过压缩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中去

我单步调试过,确实是写不进去,请问如何解决?
...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
pencil001
C# 111,128 成员 642,536 内容