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

WCF獲取客戶端IP正確代碼操作剖析

開發(fā) 開發(fā)工具
我們今天將會在這篇文章中以一段代碼示例來為大家詳細(xì)介紹一下WCF獲取客戶端IP的相關(guān)實(shí)現(xiàn)方法,希望大家可以充分掌握這一技巧。

WCF應(yīng)用方法比較靈活,可以為開發(fā)人員創(chuàng)造一個(gè)跨平臺的解決方案。我們在這里會為大家詳細(xì)講解一下有關(guān)WCF獲取客戶端IP的操作方法,希望對這方面又需要的朋友們可以從中獲得一些幫助。

WCF獲取客戶端IP的簡單方法:

  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;using System.Runtime.Serialization;  
  4. using System.ServiceModel;  
  5. using System.Text;  
  6. using System.ServiceModel.Channels;  
  7. namespace ClientInfoSample  
  8. {  
  9. public class MyService : IService  
  10. {  
  11. public string GetData(string value)  
  12. {  
  13. OperationContext context = OperationContext.Current;  
  14. MessageProperties messageProperties = context.IncomingMessageProperties;  
  15. RemoteEndpointMessageProperty endpointProperty =  
  16. messageProperties[RemoteEndpointMessageProperty.Name]  
  17. as RemoteEndpointMessageProperty;   
  18. return string.Format("Hello {0}! Your IP address is {1} and your port is {2}",  
  19. value, endpointProperty.Address, endpointProperty.Port);  
  20. }  
  21. }  
  22. }  
  23. using System;  
  24. using System.Collections.Generic;  
  25. using System.Linq;  
  26. using System.Runtime.Serialization;  
  27. using System.ServiceModel;  
  28. using System.Text;  
  29. namespace ClientInfoSample  
  30. {  
  31. [ServiceContract]  
  32. public interface IService  
  33. {  
  34. [OperationContract]  
  35. string GetData(string value);  
  36. }  

【編輯推薦】

  1. WCF代理文件相關(guān)應(yīng)用技巧分享
  2. WCF服務(wù)端安全實(shí)現(xiàn)技巧剖析
  3. WCF ABC實(shí)質(zhì)內(nèi)容介紹
  4. WCF Message類應(yīng)用基礎(chǔ)講解
  5. WCF自定義過濾器相關(guān)實(shí)現(xiàn)方法簡介
責(zé)任編輯:曹凱 來源: 博客園
相關(guān)推薦

2009-12-21 15:53:56

WCF獲取客戶端IP

2010-02-22 11:10:17

WCF獲取客戶端IP

2009-12-08 16:47:06

WCF IP

2023-11-15 13:50:07

服務(wù)端IP

2009-12-21 10:09:26

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

2009-11-05 13:00:25

WCF客戶端

2009-12-07 18:26:36

WCF客戶端

2009-12-22 18:18:11

WCF客戶端編程

2019-10-29 05:34:34

IPJava服務(wù)器

2010-02-25 16:20:02

WCF客戶端

2009-12-22 10:29:59

WCF客戶端處理

2010-12-21 11:03:15

獲取客戶端證書

2018-12-19 10:31:32

客戶端IP服務(wù)器

2010-02-23 09:58:21

WCF客戶端驗(yàn)證

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

2009-12-21 10:19:05

Silverlight

2010-02-23 15:12:25

WCF客戶端
點(diǎn)贊
收藏

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