English 中文(简体)
简化世界合作框架数据服务 答复
原标题:Streaming WCF DataService Response

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?

问题回答

您不能改变服务发出请求的方式。 活动允许你修改你的要求,但服务机构必须自称。 你的法典很可能打破了服务功能。 我还认为,你努力做的是可能的。 WCF 数据 服务处仍在内部使用周转基金,除非它使用流层,否则将总是等到整个电文传递到上层(正文)。 只有在执行

你们试图做些什么,需要草率反应(在“世界合作框架”的流中使用)。 由于存在违约的“世界合作框架”特征,加上草率反应,不属于你的控制范围。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签