2012-01-26 34 views
0

我想向我的服務添加MEX端點。當我啓動服務時,我得到WCF MEX Endpoint

WCF服務主機找不到任何服務元數據。這可能會導致 客戶端應用程序 運行不正確。請檢查是否啓用了元數據。你想 退出嗎?

這裏是我的配置文件:

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <system.web> 
    <compilation debug="true" /> 
    </system.web> 

    <system.serviceModel> 
    <services> 
     <service name="WcfServiceLibrary1.CustomerService" 
       behaviorConfiguration="Metadata"> 

     <endpoint address="" 
        binding="wsHttpBinding" 
        contract="WcfServiceLibrary1.IService1"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 

     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000" /> 
      </baseAddresses> 
     </host> 

     </service> 
    </services> 

    <behaviors> 
     <serviceBehaviors> 
     <behavior name="Metadata"> 
      <serviceMetadata httpGetEnabled="true" /> 
     </behavior> 
     <behavior> 
      <serviceMetadata httpGetEnabled="True"/> 
      <serviceDebug includeExceptionDetailInFaults="False" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    </system.serviceModel> 

</configuration> 

任何人都知道爲什麼我仍然得到消息?

謝謝

+1

什麼你的意思「當我啓動服務」嗎?你是如何託管服務:自我託管,IIS或使用主機內置的Visual Studio? –

回答

0

您不必指定mex端點AND httpGetEnabled。只需要一個公開元數據。請勿指定httpGetUrl,因爲這取決於您的託管環境。

試試這個..

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 

    <system.web> 
    <compilation debug="true" /> 
    </system.web> 

    <system.serviceModel> 
    <services> 
     <service name="WcfServiceLibrary1.CustomerService" 
       behaviorConfiguration="Metadata"> 

     <endpoint address="" 
        binding="wsHttpBinding" 
        contract="WcfServiceLibrary1.IService1"> 
      <identity> 
      <dns value="localhost" /> 
      </identity> 
     </endpoint> 

     <endpoint address="mex" 
        binding="mexHttpBinding" 
        contract="IMetadataExchange" /> 
     <host> 
      <baseAddresses> 
      <add baseAddress="http://localhost:8000" /> 
      </baseAddresses> 
     </host> 

     </service> 
    </services> 
    </system.serviceModel> 

</configuration>