免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

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

    創(chuàng)新互聯(lián)建站服務(wù)項(xiàng)目包括泗洪網(wǎng)站建設(shè)、泗洪網(wǎng)站制作、泗洪網(wǎng)頁制作以及泗洪網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,泗洪網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到泗洪省份的部分城市,未來相信會(huì)繼續(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://m.newbst.com/article4/dcepoe.html

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

廣告

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

微信小程序開發(fā)