在ASP.NET中关于分块传输编码的HTTP请求的阅读体

编程入门 行业动态 更新时间:2024-10-24 16:24:59
本文介绍了在ASP.NET中关于分块传输编码的HTTP请求的阅读体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

J2ME客户端正在发送带有分块传输编码的HTTP POST请求.

A J2ME client is sending HTTP POST requests with chunked transfer encoding.

当ASP.NET(在IIS6和WebDev.exe.server中)尝试读取请求时,它将Content-Length设置为0.我猜这是可以的,因为在加载请求时,Content-length是未知的.

When ASP.NET (in both IIS6 and WebDev.exe.server) tries to read the request it sets the Content-Length to 0. I guess this is ok because the Content-length is unknown when the request is loaded.

但是,当我读到最后的Request.InputStream时,它返回0.

However, when I read the Request.InputStream to the end, it returns 0.

这是我用来读取输入流的代码.

Here's the code I'm using to read the input stream.

using (var reader = new StreamReader(httpRequestBodyStream, BodyTextEncoding)) { string readString = reader.ReadToEnd(); Console.WriteLine("CharSize:" + readString.Length); return BodyTextEncoding.GetBytes(readString); }

例如,我可以使用Fiddler模​​拟客户的行为

I can simulate the behaiviour of the client with Fiddler, e.g.

URL localhost:15148/page.aspx

标题: 用户代理:提琴手 传输编码:分块 主持人:somesite:15148

Headers: User-Agent: Fiddler Transfer-Encoding: Chunked Host: somesite:15148

身体 兔子兔子兔子.感谢您的光临,它非常有用!

Body rabbits rabbits rabbits rabbits. thanks for coming, it's been very useful!

我的身体阅读器从上面返回一个长度为零的字节数组... lame ...

My body reader from above will return a zero length byte array...lame...

有人知道如何在IIS和ASP.NET开发服务器(cassini)上启用分块编码吗?

Does anyone know how to enable chunked encoding on IIS and ASP.NET Development Server (cassini)?

我为IIS找到了此脚本,但是它不起作用.

I found this script for IIS but it isn't working.

推荐答案

似乎是官方的:卡西尼语不支持Transfer-Encoding: chunked请求.

Seems to be official: Cassini does not support Transfer-Encoding: chunked requests.

默认情况下,客户端发送大 使用分块的HTTP生成二进制流 传输编码. 因为ASP.NET 开发服务器不支持 这种编码,您不能使用 该Web服务器托管流媒体 必须接受大型数据服务 二进制流.

By default, the client sends large binary streams by using a chunked HTTP Transfer-Encoding. Because the ASP.NET Development Server does not support this kind of encoding, you cannot use this Web server to host a streaming data service that must accept large binary streams.

更多推荐

在ASP.NET中关于分块传输编码的HTTP请求的阅读体

本文发布于:2023-11-14 04:45:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1586253.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:ASP   NET   HTTP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!