【发布时间】:2015-03-22 15:57:47
【问题描述】:
我在 VB.Net(v2.0 框架)中有一个程序,在从 sql 数据阅读器执行 http post 时,我在几台机器上收到以下错误:
System.NotSupportedException: The stream does not support concurrent IO read or write operations.
at System.Net.ConnectStream.InternalWrite(Boolean async, Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at System.Net.ConnectStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at ProtoBuf.ProtoWriter.Flush(ProtoWriter writer)
at ProtoBuf.ProtoWriter.Dispose()
at ProtoBuf.ProtoWriter.System.IDisposable.Dispose()
at ProtoBuf.Meta.TypeModel.SerializeWithLengthPrefix(Stream dest, Object value, Type type, PrefixStyle style, Int32 fieldNumber, SerializationContext context)
at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style, Int32 fieldNumber)
at ProtoBuf.Serializer.SerializeWithLengthPrefix[T](Stream destination, T instance, PrefixStyle style)
代码:
postStream = request.GetRequestStream()
While dr.Read()
dd.Add(dr) ' Adding data row to proto
ProtoBuf.Serializer.SerializeWithLengthPrefix(Of DataDump)(postStream, dd, ProtoBuf.PrefixStyle.Base128) ' stream proto to http post stream
dd.Clear() ' Clear proto
End While
response = DirectCast(request.GetResponse(), HttpWebResponse)
【问题讨论】:
标签: vb.net memory httpwebrequest http-post protobuf-net