<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <system.serviceModel> <client> <endpoint name="bookInfo1" address="net.tcp://localhost:8082/BookService" binding="netTcpBinding" contract="WCFService.IBookService" > </endpoint> <endpoint name="bookInfo" address="http://localhost:8081/service/basic" binding="basicHttpBinding" contract="WCFService.IBookService"> </endpoint> </client> </system.serviceModel> </configuration>
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WCFService.Models; using WCFServiceProxy; namespace ConsoleWCFTest { class Program { static void Main(string[] args) { var result = BookServiceProxy.Add("WCF编程", 12); List<Book> list = BookServiceProxy.GetList(); Console.WriteLine("Add:" + result); Console.WriteLine("GetList:" + list); Console.ReadLine(); } } }
原文:http://www.cnblogs.com/wzq806341010/p/3603654.html