zoukankan      html  css  js  c++  java
  • WCF服务

    解决方案-》添加新建项目-》WCF服务应用程序

    每个服务都包含一个ServiceContract 默认的IService1

    然后添加对服务的引用

          static void Main()
    {
    using (Service1Client client = new Service1Client())//使用服务
    {
    Console.WriteLine(client.ClientCredentials);
    Console.WriteLine(client.Add(1, 3));
    }
    Console.ReadKey();
    }

    生成的XML文件

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <system.serviceModel>
    <bindings>
    <basicHttpBinding>
    <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
    openTimeout
    ="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
    allowCookies
    ="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
    maxBufferSize
    ="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
    messageEncoding
    ="Text" textEncoding="utf-8" transferMode="Buffered"
    useDefaultWebProxy
    ="true">
    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
    maxBytesPerRead
    ="4096" maxNameTableCharCount="16384" />
    <security mode="None">
    <transport clientCredentialType="None" proxyCredentialType="None"
    realm
    ="" />
    <message clientCredentialType="UserName" algorithmSuite="Default" />
    </security>
    </binding>
    </basicHttpBinding>
    </bindings>
    <client>
    <endpoint address="http://localhost:9557/Service1.svc" binding="basicHttpBinding"
    bindingConfiguration
    ="BasicHttpBinding_IService1" contract="ServiceReference1.IService1"
    name
    ="BasicHttpBinding_IService1" />
    </client>
    </system.serviceModel>
    </configuration>




  • 相关阅读:
    shell 数组遍历加引号和不加引号的区别?
    shell map数据结构的实现
    PyCharm 项目打开窗口设置为当前还是新开一个怎么办?
    python 模拟ssh 登录远程服务器
    python 字节码死磕
    docker相关内容
    Windows7安装 docker-compose的过程
    史上最简单的Docker入门教程
    MySQL触发器使用详解
    存储过程
  • 原文地址:https://www.cnblogs.com/smailxiaobai/p/2306440.html
Copyright © 2011-2022 走看看