zoukankan      html  css  js  c++  java
  • WCF中的配置

    • 我们也可以定义多个endpoint

      <services>
      <service
      name="Microsoft.ServiceModel.Samples.CalculatorService"
      behaviorConfiguration="CalculatorServiceBehavior">
      <endpoint address=""
      binding="wsHttpBinding"
      contract="Microsoft.ServiceModel.Samples.ICalculator" />
      <endpoint address="mex"
      binding="mexHttpBinding"
      contract=" Microsoft.ServiceModel.Samples.IMetadataExchange" />
      </service>
      </services>

      <host>
      <baseAddresses>
      <add baseAddress=
      "http://localhost/ServiceModelSamples/service.svc"/>
      </baseAddresses>
      </host>

    如果address值为空,那么endpoint的地址就是默认的基地址(Base Address)。
    例如ICalculator服务的地址就是http://localhost/servicemodelsamples/service.svc,
    而IMetadataExchange服务的地址则为http://localhost/servicemodelsamples/service.svc/mex。
    这里所谓的基地址可以在中通过配置来定义:

    当我们在定义一个实现了Service Contract的类时, binding和address信息是客户端必须知道的,否则无法调用该服务。然而,如果需要指定服务在执行方面的相关特性时,就必须定义服务的behavior。在WCF中,定义behavior就可以设置服务的运行时属性,甚至于通过自定义behavior插入一些自定义类型。例如通过指定ServiceMetadataBehavior,可以使WCF服务对外公布Metadata。

    <behaviors>
    <serviceBehaviors>
    <behavior name="metadataSupport">
    <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
    </behavior>
    <serviceBehaviors>
    <behaviors>

  • 相关阅读:
    LVS Nginx和HAproxy的区别,怎么选择最好
    PXE+kickstart自动化安装
    DHCP服务搭建
    自动化安装
    Zabbix trigger(触发器)设置
    Zabbix Agent 安装指南和 Zabbix Server 设置自动发现
    Zabbix Server安装指南
    MariaDB安装
    事件绑定
    事件驱动式
  • 原文地址:https://www.cnblogs.com/gossip/p/2398725.html
Copyright © 2011-2022 走看看