HttpWebRequest initializing - response never received

隐身守侯 提交于 2019-12-04 18:21:52

I have no idea if this would work for you but I had the same problem,

and explicitly setting

request.AllowReadStreamBuffering = false; request.Method = "GET";

seemed to whatever reason get my callback to fire...

I'm not sure why.

It might help to switch on UseUnsafeHeaderParsing, given the flakey nature of Shoutcast "HTTP".

Does your code work when you turn it onto normal web pages?

EDIT

This looks like an excellent lead: Perhaps you need to set AllowReadStreamBuffering to false:

The AllowReadStreamBuffering property affects when the callback from BeginGetResponse method is called. When the AllowReadStreamBuffering property is true, the callback is raised once the entire stream has been downloaded into memory. When the AllowReadStreamBuffering property is false, the callback is raised as soon as the stream is available for reading which may be before all data has arrived.

The default setting for AllowReadStreamBuffering is true. This means you'll never hit the callback, because the download never ends (and left for long enough, you'll probably run out of memory). Set it to false.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!