I m trying to stream the response of my wcf dataservice to make waiting time more user friendly. The response is in XML format (I use entity framework 4.1) I have these predefined events
service.SendingRequest += service_SendingRequest;
service.ReadingEntity += service_ReadingEntity;
service.WritingEntity += service_WritingEntity;
之后,我称之为“数据服务”。
var items = myItems.Query.Execute();
这里是休庭事件。
var response = (HttpWebResponse)e.Request.GetResponse();
var resStream = response.GetResponseStream();
var sb = new StringBuilder();
var buf = new byte[1024];
string tempString;
int count;
do
{
count = resStream.Read(buf, 0, buf.Length);
if (count != 0)
{
tempString = Encoding.ASCII.GetString(buf, 0, count);
sb.Append(tempString);
}
}
while (count > 0);
So the problem is that after that nothing is happening. The next event ReadingEntity is not firing. How can I solve this issue?