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

如何建立WCF IP相關(guān)客戶端

開發(fā) 后端
WCF IP其混合了函數(shù)語言和物件導(dǎo)向程序編制語言,并且完美的適用于編程、算法、技術(shù)和探索性開發(fā),因此可以在使用的過程當(dāng)中感受到趣味性和吸引力。

我在家里使用WCF做通訊,里面需要WCF做客戶端的IP,經(jīng)過在服務(wù)器上進(jìn)行了修改,我卻發(fā)現(xiàn)WCF 3.0 里面并不支持這個功能。沒事上周在微軟官網(wǎng)下的3.5的新版WCF中提供了WCF IP這個方法。

不說廢話,直接看如何實現(xiàn)WCF IP。簡單定義一個WCF IP服務(wù):

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Runtime.Serialization;  
  5. using System.ServiceModel;  
  6. using System.Text;  
  7. using System.ServiceModel.Channels;   
  8. namespace ClientInfoSample  
  9. {  
  10. public class MyService : IService  
  11. {  
  12. public string GetData(string value)  
  13. {  
  14. OperationContext context = OperationContext.Current;  
  15. MessageProperties essageProperties = context.IncomingMessageProperties;  
  16. RemoteEndpointMessageProperty endpointProperty =  
  17. messageProperties  [RemoteEndpointMessageProperty.Name]  
  18. as RemoteEndpointMessageProperty;  
  19.  
  20. return string.Format("Hello {0}! Your IP address is {1} and your port is {2}",  value, endpointProperty.Address, endpointProperty.Port);  
  21. }  
  22. }  
【編輯推薦】
  1. 解決相關(guān)WCF Service事件
  2. 詳細(xì)介紹WCF回調(diào)返回值說明
  3. 更高效進(jìn)行WCF代碼編制介紹處理
  4. 如何正確對Silverlight WCF創(chuàng)建
  5. 對于WCF雙向進(jìn)行圖示講演
責(zé)任編輯:chenqingxiang 來源: NET130
相關(guān)推薦

2009-12-21 15:53:56

WCF獲取客戶端IP

2010-02-22 11:10:17

WCF獲取客戶端IP

2010-02-24 16:17:09

WCF獲取客戶端IP

2009-11-05 13:00:25

WCF客戶端

2009-12-07 18:26:36

WCF客戶端

2009-12-22 18:18:11

WCF客戶端編程

2010-02-25 16:20:02

WCF客戶端

2009-12-22 10:29:59

WCF客戶端處理

2009-12-21 10:09:26

WCF創(chuàng)建客戶端服務(wù)對

2019-10-29 05:34:34

IPJava服務(wù)器

2010-02-23 09:58:21

WCF客戶端驗證

2010-02-24 16:39:27

WCF客戶端處理

2009-11-05 13:08:44

WCF客戶端配置

2009-11-09 15:49:01

WCF異步調(diào)用

2011-09-09 09:44:23

WCF

2023-11-15 13:50:07

服務(wù)端IP

2018-12-19 10:31:32

客戶端IP服務(wù)器

2009-12-21 10:19:05

Silverlight

2010-02-23 15:12:25

WCF客戶端

2010-08-31 16:29:40

DHCP客戶端
點贊
收藏

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