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请求的阅读体
发布评论