1、  解决思路:

           1.将获取的网络流转化成内存流

           2.内存流位置指向0     

2、具体操作:

public MemoryStream StreamToMemoryStream(Stream stream)
{
    MemoryStream memoryStream = new MemoryStream();

    //将基础流写入内存流
    const int bufferLength = 1024;
    byte[] buffer = new byte[bufferLength];
    int actual = stream.Read(buffer, 0, bufferLength);
    while (actual > 0)
    {
        // 读、写过程中,流的位置会自动走。
        memoryStream.Write(buffer, 0, actual);
        actual = stream.Read(buffer, 0, bufferLength);
    }
    memoryStream.Position = 0;

    return memoryStream;
}