WCF服务库隔离合同

时间:2014-11-05 10:41:16

标签: wcf service contracts

我想在单独的模块中编写WCF服务库

  1. 合同(IServices)的一个模块(类库)。
  2. 合同实施(服务)的一个模块(类库)。
  3. 一个模块(通过参考上述2个模块的WCF服务库) 配置(托管)服务。 - 它只包含app.config。
  4. 当我开始运行解决方案时,我收到以下错误。 "缺少MetaData"

    在配置文件中,我按以下方式指定了端点信息

     <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    
      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <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="MyCompany.Framework.Services.ContractImplemenations.ProjectService">
            <host>
              <baseAddresses>
                <add baseAddress = "http://localhost:8733/Services/ProjectService" />
              </baseAddresses>
            </host>
            <!-- Service Endpoints -->
            <!-- Unless fully qualified, address is relative to base address supplied above -->
            <endpoint address="" binding="basicHttpBinding" contract="MyCompany.Framework.Services.Contracts.IProjectService">
              <!-- 
                  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>
              <!-- To avoid disclosing metadata information, 
              set the values below to false before deployment -->
              <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
    

    谢谢,

0 个答案:

没有答案