Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/web-services/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Web services .NET Web服务上的Gzip流导致无效字符问题_Web Services_Gzipstream - Fatal编程技术网

Web services .NET Web服务上的Gzip流导致无效字符问题

Web services .NET Web服务上的Gzip流导致无效字符问题,web-services,gzipstream,Web Services,Gzipstream,我正在处理一个复杂的.NET客户机-服务器体系结构定制,除了可以将我的东西添加到请求/回复对象之外,我完全无法控制发送或接收的请求/回复 我在服务器端有一个数据集要发送到客户端,我正在使用GZipStream压缩数据集。压缩工作正常,但当在客户端接收到回复时,会出现无效字符异常-0x1F。我在谷歌上搜索,找不到合适的资源来解决这个问题 压缩代码: Private Function Compress(ByVal data() As Byte) As Byte() Try

我正在处理一个复杂的.NET客户机-服务器体系结构定制,除了可以将我的东西添加到请求/回复对象之外,我完全无法控制发送或接收的请求/回复

我在服务器端有一个数据集要发送到客户端,我正在使用GZipStream压缩数据集。压缩工作正常,但当在客户端接收到回复时,会出现无效字符异常-0x1F。我在谷歌上搜索,找不到合适的资源来解决这个问题

压缩代码:

Private Function Compress(ByVal data() As Byte) As Byte()
        Try
            '---the ms is used for storing the compressed data---
            Dim ms As New MemoryStream()
            Dim zipStream As Stream = Nothing

            zipStream = New GZipStream(ms, _
                            CompressionMode.Compress, True)
            '---or---
            'zipStream = New DeflateStream(ms, _
            '                CompressionMode.Compress, True)

            '---compressing using the info stored in data---
            zipStream.Write(data, 0, data.Length)
            zipStream.Close()

            ms.Position = 0
            '---used to store the compressed data (byte array)---
            Dim compressed_data(CInt(ms.Length - 1)) As Byte

            '---read the content of the memory stream into 
            '   the byte array---
            ms.Read(compressed_data, 0, CInt(ms.Length))
            Return compressed_data
        Catch ex As Exception
            Return Nothing
        End Try
    End Function
考虑到我可以更改请求/响应处理机制,任何解决此问题的想法都是非常值得赞赏的。此外,我还想了解如何更好地通过webservice处理大型数据集传输。多谢各位