内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

WCF客戶端代理-創(chuàng)新互聯(lián)

    創(chuàng)新互聯(lián)建站服務(wù)項目包括泗洪網(wǎng)站建設(shè)、泗洪網(wǎng)站制作、泗洪網(wǎng)頁制作以及泗洪網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,泗洪網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到泗洪省份的部分城市,未來相信會繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!
  • 創(chuàng)建類庫WCFServiceProxy
  • 添加System.ServiceModel、WCFService(見上篇文章)引用
  • 創(chuàng)建類:BookServiceClient
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using System.Threading.Tasks;
using WCFService;
using WCFService.Models;

namespace WCFServiceProxy
{
public class BookServiceClient : ClientBase<IBookService>, IBookService
    {
public BookServiceClient() : base() { }
public BookServiceClient(string endpointConfigurationName) : base(endpointConfigurationName) { }
public BookServiceClient(string endpointConfigurationName, string remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
public BookServiceClient(string endpointConfigurationName, EndpointAddress remoteAddress) : base(endpointConfigurationName, remoteAddress) { }
public BookServiceClient(Binding binding, EndpointAddress remoteAddress) : base(binding, remoteAddress) { }
public bool Add(string name, double price)
        {
return base.Channel.Add(name, price);
        }

public List<Book> GetList()
        {
return base.Channel.GetList();
        }
    }
}
創(chuàng)建類BookServiceProxyWCF客戶端代理
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using WCFService.Models;

namespace WCFServiceProxy
{
public static class BookServiceProxy
    {
private static string _clientEndpointName = "bookInfo";
static List<Book> list = new List<Book>();
public static bool Add(string name, double price)
        {
            BookServiceClient client= null;
try
            {
                client= new BookServiceClient(_clientEndpointName);
                client.Add(name, price);
                client.Close();
return true;
            }
catch (Exception ex)
            {
if (client != null && client.State != CommunicationState.Closed)
                {
                    client.Abort();
                    client= null;
                }
return false;
            }
finally
            {
                client= null;
            }
        }

public static List<Book> GetList()
        {
            BookServiceClient client= null;
try
            {
                client= new BookServiceClient(_clientEndpointName);
                list= client.GetList();
                client.Close();
return list;
            }
catch (Exception ex)
            {
if (client != null && client.State != CommunicationState.Closed)
                {
                    client.Abort();
                    client= null;
                }
return null;
            }
finally
            {
                client= null;
            }
        }
    }
}

文章標(biāo)題:WCF客戶端代理-創(chuàng)新互聯(lián)
轉(zhuǎn)載源于:http://www.rwnh.cn/article4/dcepoe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站改版、網(wǎng)站設(shè)計公司軟件開發(fā)、標(biāo)簽優(yōu)化Google、品牌網(wǎng)站設(shè)計

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)
寿宁县| 青田县| 那坡县| 高淳县| 慈利县| 静乐县| 涿州市| 青阳县| 上思县| 齐齐哈尔市| 山阴县| 太原市| 南木林县| 安陆市| 正蓝旗| 肃北| 资溪县| 博白县| 台南市| 崇文区| 扶余县| 嘉定区| 鹿邑县| 民和| 怀化市| 松潘县| 兴山县| 建德市| 蓬安县| 中江县| 桐庐县| 灵武市| 长汀县| 公安县| 屯门区| 邵武市| 高碑店市| 巨野县| 酒泉市| 青田县| 成武县|