WCF配置

服务端

<system.serviceModel>
    <services>
      <service name="WCF.Homedo.Service.Cache.Service">
        <endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBindingConfiguration"
            contract="Interface.Homedo.Service.ICache" />
      </service>
    </services>
    <bindings>
      <wsHttpBinding>
        <binding name="wsHttpBindingConfiguration" maxBufferPoolSize="21474835647" maxReceivedMessageSize="2147483647" messageEncoding="Text">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="None"></security>
        </binding>
      </wsHttpBinding>
      <netTcpBinding>
        <binding name="netTcpBindingConfiguration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="24.00:00" sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10"  >
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647 " maxArrayLength="2147483647 " maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="24.00:00" enabled="true" />
          <security mode="None"></security>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WCF.Homedo.Service.Cache.Service">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

客户端

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_IService" closeTimeout="00:00:10" openTimeout="00:00:10" receiveTimeout="00.01:00" sendTimeout="00:01:00"
            bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
      <netTcpBinding>
        <binding name="NetTcpBinding_IService" closeTimeout="00:00:10" openTimeout="00:00:10" receiveTimeout="00.01:00" sendTimeout="00:01:00"
            transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10"
            maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="1000"
            maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
              maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <reliableSession ordered="true" inactivityTimeout="24.00:00"
              enabled="true" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <!--<endpoint address="net.tcp://172.16.220.196:10805/Service.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice1"/>
      <endpoint address="net.tcp://172.16.220.196:10806/Service.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice2"/>
      <endpoint address="net.tcp://172.16.220.196:10807/Service.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice3"/>-->
      <endpoint address="http://172.16.220.196:10605/Service.svc" binding="wsHttpBinding"
                bindingConfiguration="WSHttpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice1"/>
      <endpoint address="http://172.16.220.196:10606/Service.svc" binding="wsHttpBinding"
                bindingConfiguration="WSHttpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice2"/>
      <endpoint address="net.tcp://172.16.220.196:10807/Service.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IService" contract="Interface.Homedo.Service.ICache" name="cacheservice3"/>
    </client>
  </system.serviceModel>
时间: 2024-08-08 13:57:33

WCF配置的相关文章

WCF 配置终结点并调用服务

wcf通过xml文件配置终结点什么的感觉有点小麻烦,个人还是觉得用代码形式配置比较好,当然在发布的时候可能会比较麻烦,需要重新编译... 下面将wcf service寄宿在控制台应用程序中并配置终结点: ? 1 2 3 4 5 6 7 8 9 10 11 using (var host = new ServiceHost(typeof(Service1),                                               new Uri("http://localhos

编写WCF服务时右击配置文件无“Edit WCF Configuration”(编辑 WCF 配置)远程的解决办法

原文:编写WCF服务时右击配置文件无“Edit WCF Configuration”远程的解决办法 今天在看<WCF揭秘>书中看到作者提出可以在一个WCF Host应用程序的App.Config文件上右击, 通过弹出的" Edit WCF Configuration”(编辑WCF配置)选项来利用GUI界面编辑WCF的配置信息. 但是我在尝试的时候并没有找到这个右键菜单,开始还以为作者弄错了,但又尝试了一会后便发现了窍门. 右键App.Config文件默认是没有" Edit

WCF学习第二篇:WCF 配置架构。这有助于对wcf配置的理解和记忆

使用 Windows Communication Foundation (WCF) 配置元素,您可以配置 WCF 服务和客户端应用程序. 可以使用配置编辑器工具 (SvcConfigEditor.exe) 创建和修改客户端和服务的配置文件. 由于配置文件的格式都是以 XML 形式设置的,因此,如果要使用文本编辑器手动编辑这些文件,则您必须熟悉 XML. 否则,您可能会遇到一些问题,如找不到某个 XML 元素标记或特性. 这是因为 XML 元素标记和属性是区分大小写的. WCF 配置系统基于 Sy

WCF配置与服务寄宿

1.项目框架如下: 2.WCF服务项目 其中WCFService中存放服务契约及其实现,需添加命名空间:System.ServiceModel 3.服务寄宿 WCFHost是一个控制台程序,用于寄宿WCF服务,需添加命名空间:System.ServiceModel和引用WCFService项目 其中需要编写的代码如下: 若直接在配置文件里配置终结点信息,则对于的代码如下: 配置文件信息如下: 4.客户端 需添加命名空间:System.ServiceModel和引用WCFService项目 客户端

WCF 配置服务 (02)

配置服务概述 • 在设计和实现服务协定后,即可配置服务. 在其中可以定义和自定义如何向客户端公开服务,包括指定可以找到服务的地址.服务用于发送和接收消息的传输和消息编码,以及服务需要的安全类型. • 配置服务的类型 – 使用配置文件配置 –  在代码中强制配置 • 实际上,编写配置是 WCF 应用程序编程的主要部分. • 使用配置文件配置WCF服务 – 通过使用配置文件配置 Windows Communication Foundation(WCF) 服务,可提供在部署时而非设计时提供终结点和服务

使用SSL的IIS下WCF配置(CSDN手动迁移)

在WCF的WebConfig配置http绑定,并设置为使用传输安全性,如下所示 1 <bindings> 2 <basicHttpBinding> 3 <binding name="secureHttpBinding"> 4 <security mode="Transport"> 5 <transport clientCredentialType="None"/> 6 </secu

高并发WCF配置

在使用WCF做服务接口时,TCP模式肯定比Http效率高,Binary/MTOM格式的绑定也会Text格式的绑定高效. 两个endpoint,一个用来调试:ms-mex的binding是用来方便WCF调试工具和远程对象应用,另一个是实际工作模式配置:customBinding. 为了提高接口的并发数,特实验custonBinding各个参数对并发的影响,以下配置是目前实验tps较高的参数配置: <system.serviceModel> <services> <service

MS对WCF配置中security节点的解释

摘录地址:http://msdn.microsoft.com/zh-CN/library/azure/ms731347 <basicHttpBinding> 的 <security> .NET Framework 4.5 其他版本 此主题尚未评级 - 评价此主题 <basicHttpBinding>.' data-guid="e1b2287de2f2b7e9bdffd3e96ec2ffba">定义 <basicHttpBinding>

wcf 配置

wcf 开发 [ServiceContract]-----接口定义1 public interface ILog { [OperationContract]------接口定义1 List<LogEntity> GetAll(); [OperationContract] List<LogEntity> GetMonthLog(string year, string month); } 1和2是必须的 1.端口开放(入站规则) 2.服务启动 3.引用服务