WCF学习中遇到的几个问题

基于IIS承载WCF Service时:

<configuration>
  <system.serviceModel>
    <services>
      <service name="WcfService.MathService" behaviorConfiguration="MathServiceBehavior">
        <endpoint address="MathService" binding="wsHttpBinding" contract="WcfService.IMathService"></endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
      </service>      
    </services>    
    <behaviors>
      <serviceBehaviors>
        <behavior name="MathServiceBehavior">
          <serviceMetadata httpGetEnabled="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration> 

红色标记处的name属性需要是服务实现类的完全限定名,否则会提示元数据交换被禁用。

红色标记处的address属性值是wcf service的相对地址,与基地址组合后才是wcf service的真实地址。


原文地址:https://www.cnblogs.com/seesky/p/2160078.html