新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
WCF獲取客戶端IP正確代碼操作剖析
WCF應(yīng)用方法比較靈活,可以為開發(fā)人員創(chuàng)造一個跨平臺的解決方案。我們在這里會為大家詳細(xì)講解一下有關(guān)WCF獲取客戶端IP的操作方法,希望對這方面又需要的朋友們可以從中獲得一些幫助。

創(chuàng)新互聯(lián)主要從事成都網(wǎng)站制作、網(wǎng)站設(shè)計、外貿(mào)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)奎文,10年網(wǎng)站建設(shè)經(jīng)驗,價格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):028-86922220
WCF獲取客戶端IP的簡單方法:
- using System;
- using System.Collections.Generic;
- using System.Linq;using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- using System.ServiceModel.Channels;
- namespace ClientInfoSample
- {
- public class MyService : IService
- {
- public string GetData(string value)
- {
- OperationContext context = OperationContext.Current;
- MessageProperties messageProperties = context.IncomingMessageProperties;
- RemoteEndpointMessageProperty endpointProperty =
- messageProperties[RemoteEndpointMessageProperty.Name]
- as RemoteEndpointMessageProperty;
- return string.Format("Hello {0}! Your IP address is {1} and your port is {2}",
- value, endpointProperty.Address, endpointProperty.Port);
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.ServiceModel;
- using System.Text;
- namespace ClientInfoSample
- {
- [ServiceContract]
- public interface IService
- {
- [OperationContract]
- string GetData(string value);
- }
- }
網(wǎng)頁題目:WCF獲取客戶端IP正確代碼操作剖析
地址分享:http://m.fisionsoft.com.cn/article/coosgog.html


咨詢
建站咨詢
