简体   繁体   English

stream不支持并发IO读取或写入操作

[英]stream does not support concurrent IO read or write operations

I'm using a network stream to read data from network in an ASP.NET application and I get this error while trying to read from the stream: 我正在使用网络流在ASP.NET应用程序中从网络读取数据,并且在尝试从流中读取时出现此错误:

stream does not support concurrent IO read or write operations

It happens sometimes. 它有时会发生。 Any idea ? 任何的想法 ?

It sounds simply as though you are trying to do two different operations on the same stream at the same time from different threads. 听起来好像你试图从不同的线程同时在同一个流上做两个不同的操作。 Adding a lock ( Monitor ) or Mutex should help synchronise access to the stream. 添加lockMonitor )或Mutex应该有助于同步对流的访问。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM