缓冲问题 [英] Buffering issue

查看:85
本文介绍了缓冲问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图通过模拟器从Windows Phone 8应用程序中读取WebRequst的响应。

I am trying to read a response from a an WebRequst from a Windows phone 8 app via Emulator.

using (var myResponse = await SendRequest("GET", "url") // send the request and wait for reply
                    {
                        if (myResponse.StatusCode == HttpStatusCode.OK)
                        {
                            try
                            {
                                var myResp  = myResponse.GetResponseStream();
                                var myTree = new XmlSerializer(typeof(MyClass));                                
                                res= (MyClass)myTree.Deserialize(resp);
                            }
                            catch (Exception e)
                            {
                                string str = e.Message;
                            }                                  

                        }
                    }




认为从网址重新调整的状态代码没问题,我仍然无法序列化响应。我收到异常"当禁用缓冲时,主线程
不支持读取"围绕
GetResponseStream()方法  。可能是什么原因?


Thought the status code retuned from the urls is OK, I am still not able to serialize the response. I am getting an exception "Read is not supported on the main thread when buffering is disabled" around the GetResponseStream() method . What could be the reason?

推荐答案

关于这个的任何消息?因为我清空了调试符号缓存,所以我正在点击它...

Any news on this one? I'm hitting it since I emptied my debugging symbol cache...

它为我抛出了一个NotSupportedException。必须是基础流的问题。返回的响应对我来说似乎没问题:它不是空的并且具有正确的mime。

It throws a NotSupportedException for me. Must be an issue with the underlying stream. The returned response seems ok to me: It's not empty and has the right mime.

流本身是一个MS.Internal.InternalNetworkStream,CanRead设置为true。几乎每个操作都会抛出NotSupportedException。

The stream itself is an MS.Internal.InternalNetworkStream with CanRead set to true. Nearly every operation throws said NotSupportedException.

我正在使用Microsoft.Bcl.Http.2.1.10。

I'm using Microsoft.Bcl.Http.2.1.10.


这篇关于缓冲问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆