[英]How the wcf blocks the client when IsOneWay=false?
主機 :具有以下功能: IsOneWay=False
調用此函數時- 在主機中彈出MessageBox 。
客戶端 :有一個winform, 只有一個按鈕可以調用主機的功能。
如果在主機IsOneWay = 真正的功能-我可以多按客戶按鈕(他不關心 ,如果我發布了消息框上的主機或沒有)。
但如果IsOneWay = 假 -然后他讓我按只有一次 ( 直到我松開主機的MesageBox)..
host does he do that ?
How the Client knows that he should be blocked until the user releases the MessageBox on the Host side ?
在關閉消息框之前,WCF主機不會響應客戶端。
如果要闖入客戶端的調試器,則應該看到代碼仍在對主機的WCF調用中。 如果您等待了足夠長的時間,它將最終超時。 WCF可以執行此操作,因為IsOneWay=false
要求服務器先返回,然后客戶端才能繼續執行。 當IsOneWay=true
,客戶端發送請求,服務器立即成功響應,允許客戶端繼續執行(在執行任何服務器代碼之前)。
IsOneWay=false
Client Server
------ | ------
1. click --> method --> messagebox waits for OK
(client can't continue until server returns)
2. continue <-- method <-- user dismisses messagebox
IsOneWay=true
Client Server
------ | ------
1. click --> method --> messagebox waits for OK
(client continues regardless of server state)
2. click --> method --> 2nd messagebox waits for OK
user dismisses messageboxes
etc...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.