2011-11-04 94 views
0

我想啓動以下WCF服務:WCF啓動主機錯誤

<system.serviceModel> 
    <services> 
    <service name="MTPlatform"> 
     <endpoint address="TradingService" behaviorConfiguration="ServiceBehaviour" 
       binding="netNamedPipeBinding" 
       bindingConfiguration="NetNamedPipeBinding_IGenericTradingInterface" 
       contract="GenericTradingInterface.IGenericTradingInterface" 
       name="TradingService" /> 
     <endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" /> 
     <host> 
     <baseAddresses> 
      <add baseAddress="net.pipe://localhost" /> 
     </baseAddresses> 
     <timeouts closeTimeout="00:00:02" openTimeout="00:00:20" /> 
     </host> 
    </service> 
    </services> 
    <bindings> 
    <netNamedPipeBinding> 
     <binding name="NetNamedPipeBinding_IGenericTradingInterface" 
       closeTimeout="00:05:20" openTimeout="00:00:20" receiveTimeout="05:20:00" 
       sendTimeout="00:10:00" transactionFlow="false" transferMode="Buffered" 
       transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" 
       maxBufferPoolSize="2147483646" maxBufferSize="2147483646" maxConnections="10" 
       maxReceivedMessageSize="2147483646"> 
       <readerQuotas maxDepth="2147483646" maxStringContentLength="2147483646" 
          maxArrayLength="2147483646" maxBytesPerRead="2147483646" 
          maxNameTableCharCount="2147483646" /> 
       <security mode="Transport"> 
       <transport protectionLevel="EncryptAndSign" /> 
       </security> 
     </binding> 
    </netNamedPipeBinding> 
    </bindings> 
    <behaviors> 
     <endpointBehaviors> 
      <behavior name="ServiceBehaviour"> 
       <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
      </behavior> 
     </endpointBehaviors> 
     <serviceBehaviors> 
      <behavior name="MetaDataBehavior"> 
       <serviceMetadata /> 
      </behavior> 
     </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

這種失敗:

合同名稱「IMetadataExchange接口」不能在執行合同的名單 被發現由服務MT5Platform。直接向配置文件或 ServiceHost添加 ServiceMetadataBehavior以啓用對此合同的支持。

我看不出大的失誤在這裏,一個在哪裏可以找到IMetadataExchange

感謝,

克林斯曼

回答

2

你需要引用您的<service>元素稱爲 「MetaDataBehavior」 的服務行爲。另外,在你的團隊的其他開發者的理智着想,請不要有端點行爲與名稱「ServiceBehaviour」 - 這是在自找麻煩:)

<system.serviceModel> 
<services> 
<service name="MTPlatform" behaviorConfiguration="MetaDataBehavior"> 
    <endpoint address="TradingService" behaviorConfiguration="IncreaseMIIOGEndpointBehaviour" 
    binding="netNamedPipeBinding" bindingConfiguration="NetNamedPipeBinding_IGenericTradingInterface" 
    name="TradingService" contract="GenericTradingInterface.IGenericTradingInterface" /> 
    <endpoint address="mex" binding="mexNamedPipeBinding" contract="IMetadataExchange" /> 
    <host> 
    <baseAddresses> 
    <add baseAddress="net.pipe://localhost" /> 
    </baseAddresses> 
    <timeouts closeTimeout="00:00:02" openTimeout="00:00:20" /> 
    </host> 
</service> 
</services> 
<behaviors> 
<endpointBehaviors> 
    <behavior name="IncreaseMIIOGEndpointBehaviour"> 
    <dataContractSerializer maxItemsInObjectGraph="2147483646" /> 
    </behavior> 
</endpointBehaviors> 
<serviceBehaviors> 
    <behavior name="MetaDataBehavior"> 
    <serviceMetadata /> 
    </behavior> 
</serviceBehaviors> 
</system.serviceModel> 
+0

優秀,THX! ! – Juergen