新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
如何建立WCFIP相關(guān)客戶端
我在家里使用WCF做通訊,里面需要WCF做客戶端的IP,經(jīng)過在服務(wù)器上進(jìn)行了修改,我卻發(fā)現(xiàn)WCF 3.0 里面并不支持這個功能。沒事上周在微軟官網(wǎng)下的3.5的新版WCF中提供了WCF IP這個方法。

創(chuàng)新互聯(lián)為企業(yè)級客戶提高一站式互聯(lián)網(wǎng)+設(shè)計服務(wù),主要包括網(wǎng)站制作、成都網(wǎng)站建設(shè)、app開發(fā)定制、微信小程序開發(fā)、宣傳片制作、LOGO設(shè)計等,幫助客戶快速提升營銷能力和企業(yè)形象,創(chuàng)新互聯(lián)各部門都有經(jīng)驗(yàn)豐富的經(jīng)驗(yàn),可以確保每一個作品的質(zhì)量和創(chuàng)作周期,同時每年都有很多新員工加入,為我們帶來大量新的創(chuàng)意。
不說廢話,直接看如何實(shí)現(xiàn)WCF IP。簡單定義一個WCF IP服務(wù):
- 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 essageProperties = 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);
- }
- }
- }
網(wǎng)站題目:如何建立WCFIP相關(guān)客戶端
URL地址:http://fisionsoft.com.cn/article/dpjssoi.html


咨詢
建站咨詢
