HttpRequest.GetBufferedInputStream 方法


获取一个 Stream 对象,该对象可用于读取传入的 HTTP 实体主体。Gets a Stream object that can be used to read the incoming HTTP entity body.

 System::IO::Stream ^ GetBufferedInputStream();
public System.IO.Stream GetBufferedInputStream ();
member this.GetBufferedInputStream : unit -> System.IO.Stream
Public Function GetBufferedInputStream () As Stream


可用于读取传入的 HTTP 实体主体的 Stream 对象。A Stream object that can be used to read the incoming HTTP entity body.


已加载和分析请求的实体主体。The request's entity body has already been loaded and parsed. 导致加载和分析实体正文的属性的示例包括:Examples of properties that cause the entity body to be loaded and parsed include the following:

- Form 属性。- The Form property.

- Files 属性。- The Files property.

- InputStream 属性。- The InputStream property.

- GetBufferlessInputStream() 方法。- The GetBufferlessInputStream() method.

要避免此异常,请首先调用 ReadEntityBodyMode 方法。To avoid this exception, call the ReadEntityBodyMode method first. 如果客户在实体正文读取时断开连接,则也会引发此异常。This exception is also thrown if the client disconnects while the entity body is being read.


此方法与 GetBufferlessInputStream 相同,不同之处在于它还复制读取到内部存储的字节,ASP.NET 使用该字节来填充 FormFilesInputStream 属性。This method is identical to GetBufferlessInputStream except that it also copies the bytes that are read to the internal storage that is used by ASP.NET to populate the Form, Files, and InputStream properties. 由于保留了此信息,如 ASP.NET Web 窗体页面(.aspx 文件)这样的下游代码将成功运行。Because this information is preserved, downstream code such as ASP.NET Web Forms pages (.aspx files) will run successfully. 这不同于使用 GetBufferlessInputStream 方法的情况。This is not the case with the GetBufferlessInputStream method.