自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

WCF托管特性ICommunicationObject接口實(shí)現(xiàn)

開(kāi)發(fā) 后端
對(duì)于常見(jiàn)的WCF托管特性我們要在工作中積累,文章只對(duì)WCF ServiceHost實(shí)現(xiàn)的ICommunicationObject接口定義的一些高級(jí)特做出代碼分析。

我們?cè)趯W(xué)習(xí)中要不斷的總結(jié)經(jīng)驗(yàn),對(duì)于一些特性我們應(yīng)該經(jīng)常做總結(jié),在里就WCF托管特性概要分析一下。在ServiceHost實(shí)現(xiàn)的ICommunicationObject接口定義了一些高級(jí)特性,如例所示。

WCF托管特性ICommunicationObject接口

  1. public interface ICommunicationObject  
  2. {  
  3. void Open();  
  4. void Close();  
  5. void Abort();  
  6. event EventHandler Closed;  
  7. event EventHandler Closing;  
  8. event EventHandler Faulted;  
  9. event EventHandler Opened;  
  10. event EventHandler Opening;  
  11. IAsyncResult BeginClose(AsyncCallback callback,object state);  
  12. IAsyncResult BeginOpen(AsyncCallback callback,object state);  
  13. void EndClose(IAsyncResult result);  
  14. void EndOpen(IAsyncResult result);  
  15. CommunicationState State  
  16. {get;}  
  17. //更多成員  
  18. }  
  19. public enum CommunicationState  
  20. {  
  21. Created,  
  22. Opening,  
  23. Opened,  
  24. Closing,  
  25. Closed,  
  26. Faulted  

#T#如果打開(kāi)或關(guān)閉宿主的操作耗時(shí)較長(zhǎng),可以采用異步方式調(diào)用BeginOpen()和BeginClose()方法。我們可以訂閱諸如狀態(tài)改變或錯(cuò)誤發(fā)生等宿主事件,通過(guò)調(diào)用State屬性查詢當(dāng)前的宿主狀態(tài)ServiceHost類同樣實(shí)現(xiàn)了Abort()方法。該方法提供強(qiáng)行退出功能,能夠及時(shí)中斷進(jìn)程中的所有服務(wù)調(diào)用,然后關(guān)閉宿主。此時(shí),活動(dòng)的客戶端會(huì)獲得一個(gè)異常。以上就是一個(gè)關(guān)于WCF托管特性的一個(gè)列舉,希望大家在以后的學(xué)習(xí)中累計(jì)。

責(zé)任編輯:田樹(shù) 來(lái)源: 博客
相關(guān)推薦

2009-11-06 15:41:25

WCF自托管宿主

2010-02-22 16:19:25

WCF自托管

2017-08-22 16:40:22

前端JavaScript接口

2010-01-26 09:50:30

C++接口

2010-06-18 15:33:19

UML接口

2009-12-21 17:05:59

WCF自托管宿主

2009-07-06 17:36:06

ResultSetJDBC Connec

2010-07-08 10:28:51

UML接口

2009-11-09 16:44:18

WCF Service

2010-02-22 15:27:05

WCF數(shù)據(jù)契約

2021-05-14 06:15:48

SpringAware接口

2009-11-05 13:21:41

WCF架構(gòu)

2010-01-15 11:31:02

VB.NET接口實(shí)現(xiàn)多

2009-08-21 15:38:45

ControllerF

2024-09-09 14:12:38

2011-03-24 13:02:35

WCF服務(wù)角色Azure

2024-09-12 15:24:29

2021-06-03 10:01:28

JDBCStatement接口

2022-09-06 08:54:00

SpringBootController

2021-05-21 10:01:01

JDBCJavaStatement接口
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)