2014-09-29 31 views
0

我試圖獲得在Windows服務主機中工作的wcf服務。我目前收到錯誤「 」無法找到與具有綁定MetadataExchangeHttpBinding的端點匹配方案http的基地址,註冊的基地址方案爲[net.tcp]。「WCF無法找到與具有綁定的端點相匹配的方案http的基地址MetadataExchangeHttpBinding

我使用.NET Framework 4.5

我試圖讓tcp.net二進制服務。任何幫助讚賞。我創建的跟蹤文件 沒有幫助。這裏是我的[修訂]的app.config:

<?xml version="1.0" encoding="utf-8" ?> 
 
<!-- IMPORTANT! To run this on your local machine, first follow instructions in http://support2.microsoft.com/kb/2785590 --> 
 
<!-- You will run into tcp listen errors otherwise --> 
 
<configuration> 
 
    <startup> 
 
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> 
 
    </startup> 
 

 

 
    <system.serviceModel> 
 
    <services> 
 
     <service name="SettingsDB.Configuration" behaviorConfiguration="DefaultBehavior"> 
 
     <endpoint binding="netTcpBinding" bindingConfiguration="max" contract="SettingsDB.IConfiguration" address="Settings" /> 
 
     <host> 
 
      <baseAddresses> 
 
      <add baseAddress="net.tcp://localhost:9000/SettingsService" /> 
 
      </baseAddresses> 
 
     </host> 
 
     </service> 
 
    </services> 
 
    <bindings> 
 
     <netTcpBinding> 
 
     <binding name="max" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="2147483647" maxReceivedMessageSize="2147483647" listenBacklog="2147483647" transactionFlow="false" portSharingEnabled="true"> 
 
      <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" /> 
 
      <reliableSession enabled="false" /> 
 
      <security mode="None" /> 
 
     </binding> 
 
     </netTcpBinding> 
 
    </bindings> 
 
    <behaviors> 
 
     <serviceBehaviors> 
 
     <behavior name="DefaultBehavior"> 
 
      <serviceMetadata httpGetEnabled="false" httpGetUrl="true" /> 
 
      <serviceDebug includeExceptionDetailInFaults="true" /> 
 
     </behavior> 
 
     </serviceBehaviors> 
 
    </behaviors> 
 
    </system.serviceModel> 
 

 
    <system.diagnostics> 
 
    <sources> 
 
     <source name="System.ServiceModel" switchValue="Information, ActivityTracing" propagateActivity="true"> 
 
     <listeners> 
 
      <add name="traceListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="c:\Traces.svclog" /> 
 
     </listeners> 
 
     </source> 
 
    </sources> 
 
    </system.diagnostics> 
 

 
    <system.web> 
 
    <compilation debug="true" /> 
 
    </system.web> 
 
    <runtime> 
 
    <gcServer enabled="true" /> 
 
    </runtime> 
 
</configuration>

回答

1

可以嘗試:

<service name="SettingsDB.Settings"> 

加名的行爲和改變httpGetUrl簡單true

<behavior> 
    <serviceMetadata httpGetEnabled="true" 
        httpGetUrl="true"  /> 
    <serviceDebug includeExceptionDetailInFaults="true" /> 
</behavior> 
+0

我現在收到錯誤「合同名稱」IMeta數據交換「無法在服務配置實施的合同列表中找到。將ServiceMetadataBehavior直接添加到配置文件或ServiceHost以啓用對此合同的支持。「 – 2014-09-30 00:46:29

+0

對不起,我已更新我的答案。在服務中有雙重名稱,它應該按上述方式工作(適用於類似於我的設置至少) – Noctis 2014-09-30 01:32:44

+1

謝謝,它讓我朝着正確的方向前進。現在我只需要弄清楚如何使用這項服務:) – 2014-09-30 15:23:40

相關問題