• 大小: 0.85M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2020-12-26
  • 语言: C#
  • 标签: WCF  实例  C#  

资源简介

实例是一个控制台服务,实现客户端调用服务中的加减乘除方法的简单实例。包含服务和客户端

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace WCFClient
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建客户端终结点
            EndpointAddress epAddress = new EndpointAddress(“http://localhost:8000/ServiceModelSamples/Service/CalculatorService“);
            ServiceReference1.ServiceClient client = new ServiceReference1.ServiceClient(new WSHttpBinding() epAddress);
            //调用wcf服务端的方法
            double value1 = 100.00d;
            double value2 = 15.99d;
            double result = client.Add(value1 value2);
            //显示加方法调用结果
            Console.WriteLine(“Add({0}{1})

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-03-13 11:40  WCFClient\
     目录           0  2019-03-13 11:40  WCFClient\.vs\
     目录           0  2019-03-13 11:40  WCFClient\.vs\WCFClient\
     目录           0  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\
     文件       33792  2019-03-13 14:26  WCFClient\.vs\WCFClient\v15\.suo
     目录           0  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\Server\
     目录           0  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\Server\sqlite3\
     文件           0  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\Server\sqlite3\db.lock
     文件        4096  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\Server\sqlite3\storage.ide
     文件       32768  2019-03-13 11:40  WCFClient\.vs\WCFClient\v15\Server\sqlite3\storage.ide-shm
     文件     2327832  2019-03-13 14:26  WCFClient\.vs\WCFClient\v15\Server\sqlite3\storage.ide-wal
     目录           0  2019-03-13 13:25  WCFClient\WCFClient\
     文件        1125  2019-03-13 11:40  WCFClient\WCFClient.sln
     文件         933  2019-03-13 11:47  WCFClient\WCFClient\App.config
     目录           0  2019-03-13 11:40  WCFClient\WCFClient\bin\
     目录           0  2019-03-13 11:54  WCFClient\WCFClient\bin\Debug\
     文件       11776  2019-03-13 13:25  WCFClient\WCFClient\bin\Debug\WCFClient.exe
     文件         933  2019-03-13 11:47  WCFClient\WCFClient\bin\Debug\WCFClient.exe.config
     文件       30208  2019-03-13 13:25  WCFClient\WCFClient\bin\Debug\WCFClient.pdb
     目录           0  2019-03-13 11:46  WCFClient\WCFClient\Connected Services\
     目录           0  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\
     文件       17099  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\CalculatorService.wsdl
     文件        1718  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\configuration.svcinfo
     文件       21406  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\configuration91.svcinfo
     文件        5174  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Reference.cs
     文件        2435  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Reference.svcmap
     文件         391  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Service.disco
     文件        3783  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Service.wsdl
     文件        2488  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Service.xsd
     文件        2155  2019-03-13 11:45  WCFClient\WCFClient\Connected Services\ServiceReference1\Service1.xsd
     目录           0  2019-03-13 11:46  WCFClient\WCFClient\Connected Services\ServiceReference2\
............此处省略71个文件信息

评论

共有 条评论