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

资源简介

WCF分布式开发示例代码
包括:
1)一个“服务类”WCFService:采用 C#语言编写,实现一个或多个方法,也叫服务契约和操作契约。
2)一个“宿主”环境WCFHost:这是一种应用程序域和进程,服务将在该环境中运行。 
3)一个“终结点”Client:由客户端用于访问服务。 

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace WCFClient
{
    class WCFClient
    {
        static void Main(string[] args)
        {
            
            //IWCFService proxy = ChannelFactory.CreateChannel(new WSHttpBinding()
            //////new EndpointAddress(“net.tcp://localhost:8001/WCFService“));
            ////new EndpointAddress(“http://localhost:8002/WCFService“));

            WCFServiceClient wcfServiceProxy = new WCFServiceClient(“WSHttpBinding_IWCFService1“);

            
            //通过代理调用SayHello服务
            Console.WriteLine(wcfServiceProxy.SayHello(“Frank Xu Lei“));
            ////通过代理调用调用SayHelloToUser传递对象
     

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2014-06-12 23:15  WCFServiceFrankXuLei\
     文件         252  2015-03-11 20:48  WCFServiceFrankXuLei\ReadMe.txt
     目录           0  2009-03-15 14:57  WCFServiceFrankXuLei\WCFClientFrankXuLei\
     目录           0  2009-03-16 01:21  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\
     文件        3556  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\app.config
     目录           0  2009-03-15 14:57  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\
     目录           0  2009-03-16 01:23  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\
     文件        8192  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.exe
     文件        3556  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.exe.config
     文件       19968  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.pdb
     文件       11592  2014-06-11 22:46  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.vshost.exe
     文件        3556  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.vshost.exe.config
     文件         490  2007-07-21 01:33  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\bin\Debug\WCFClient.vshost.exe.manifest
     目录           0  2009-03-15 14:57  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\
     目录           0  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\
     目录           0  2009-03-15 22:27  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\TempPE\
     文件        6656  2009-03-15 22:27  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\TempPE\Service References.WCFServiceReferenceFrankXuLei.Reference.cs.dll
     文件        1642  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\WCFClient.csproj.FileListAbsolute.txt
     文件        8192  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\WCFClient.exe
     文件       19968  2014-06-11 22:52  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\obj\Debug\WCFClient.pdb
     文件        1070  2009-03-16 01:21  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Program.cs
     目录           0  2009-03-15 14:57  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Properties\
     文件        1469  2009-03-14 20:34  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Properties\AssemblyInfo.cs
     目录           0  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\
     目录           0  2009-03-15 22:27  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\
     文件        4670  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\configuration.svcinfo
     文件        5377  2009-03-15 22:27  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\Reference.cs
     文件        2286  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\Reference.svcmap
     文件         357  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\WCFService.disco
     文件        2912  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\WCFService.wsdl
     文件         922  2009-03-15 20:40  WCFServiceFrankXuLei\WCFClientFrankXuLei\WCFClient\Service References\WCFServiceReferenceFrankXuLei\WCFService.xsd
............此处省略65个文件信息

评论

共有 条评论