WCF服务调用:如何从WCF调用收到响应后执行下一行 [英] WCF Service call : How to execute next line once response received from WCF call

查看:71
本文介绍了WCF服务调用:如何从WCF调用收到响应后执行下一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从我的客户端应用程序调用WCF服务。我正在使用双工通信。我的问题是,一旦我调用WCF服务,同时它将执行下一行代码,即myText字符串......我不想这样做。我如何限制?





客户代码:



代理.GetProcessedFileData();

String myText =这是收到回复后的文字

//其他功能....

< br $>


服务代码:



I am calling WCF Service from my client application. I am using Duplex communication. My issue is that once I call the WCF service, same time it is going to execute next line code which is myText string... And I don't want to do that. How do I restrict that?


Client Code :

Proxy.GetProcessedFileData();
String myText= "This is the text after receiving response"
// Other functionality....


Service Code :

<OperationContract(IsOneWay:=True)> _
Sub GetProcessedFileData()

推荐答案





阅读: http://msdn.microsoft.com/en-us/library/ms733035(v = vs.110).aspx [ ^ ]



您已经提到了IsOneWay,因此您的客户将会这样做不要指望服务器有任何响应,并且在通话结束后它开始前进。



因此将其设置为IsOneWay为假,然后您的客户端将等待响应。
Hi,

Read this : http://msdn.microsoft.com/en-us/library/ms733035(v=vs.110).aspx[^]

You have mentioned IsOneWay so your client will not expect any response from server and after the call its start moving forward.

So set it to IsOneWay false then your client will wait for response.


我已经尝试了但是它没有用...如果我们将值设置为false,服务将抛出异常。



我有以下好的例子仅供参考,但同样的事情也是如此。



http://www.dotnetcurry.com/showarticle.aspx?ID=721 [ ^ ]
I have tried that but it's not working... Service will throw an exception if we set value to false.

I have below good example for reference but again in that it happens the same thing.

http://www.dotnetcurry.com/showarticle.aspx?ID=721[^]


这篇关于WCF服务调用:如何从WCF调用收到响应后执行下一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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