我Service启动后报错如下:
这是 Windows© Communication Foundation 服务。当前已禁用此服务的元数据发布。如果具有该服务的访问权限,则可以通过完成下列步骤来修改 Web 或应用程序配置文件以便启用元数据发布:1. 创建下列服务行为配置,或将 <serviceMetadata> 元素添加到现有服务行为配置:<behaviors>
    <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors" >
            <serviceMetadata httpGetEnabled="true" />
        </behavior>
    </serviceBehaviors>
</behaviors>2. 将行为配置添加到服务:<service name="MyNamespace.MyServiceType" behaviorConfiguration="MyServiceTypeBehaviors" >注意: 服务名称必须与服务实现的配置名称相匹配。3. 将下列终结点添加到服务配置:<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" />注意: 服务必须有一个 http 基址以便添加此终结点。
Server端代码如下:namespace WCFServiceServer
{
    class Program
    {
        static void Main(string[] args)
        {
            string url = "http://localhost:8000/ToolServices";
            ServiceHost host = new ServiceHost(typeof(ToolServiceProvider),
                new Uri(url));
            host.AddServiceEndpoint(typeof(IToolService), new BasicHttpBinding(), "");
            host.Open();
            Console.WriteLine(string.Format("服务已启动,监控的服务为{0}",url));
            Console.ReadLine();
        }
    }
}
我的XML配置如下:<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <services>
      
      <service name="WCFService.ToolServiceProvider" behaviorConfiguration="">
           <host>
          <baseAddresses>
            <add baseAddress = "http://localhost:8000/ToolServices" />
            
          </baseAddresses>
          
        </host>
        <!-- Service Endpoints -->
        <!-- Unless fully qualified, address is relative to base address supplied above -->
        <endpoint address ="" binding="wsHttpBinding" contract="WCFService.IToolService">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <!--<identity>
            <dns value="localhost"/>
          </identity>-->
        </endpoint>
        <!-- Metadata Endpoints -->
        <!-- The Metadata Exchange endpoint is used by the service to describe itself to clients. --> 
        <!-- This endpoint does not use a secure binding and should be secured or removed before deployment -->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>