2010-06-01 202 views
1

我有一個WCF .svc文件託管在IIS中。我想使用basicHTTP綁定。這項服務工作實際上是通過net.tcp調用另一項服務。一切工作正常本地,但是當我部署,我得到這個錯誤。WCF幫助,如何通過http公開服務,通過net.tcp調用另一個服務?

提供的URI方案'http'是 無效;預計'net.tcp'。參數 名稱:通過

這裏是服務器配置

<client> 
    <endpoint address="net.tcp://localhost:9300/InternalInterfaceService" 
     binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IInternalInterfaceService" 
     contract="IInternalInterfaceService" name="NetTcpBinding_IInternalInterfaceService"> 
    <identity> 
     <servicePrincipalName value="localhost" /> 
    </identity> 
    </endpoint> 
</client> 
<services> 
<service name="MyExternalService"> 
<endpoint address="" binding="basicHttpBinding" contract="IMyExternalService" /> 
</service> 
</services> 

這裏是SvcUtil工具生成

<system.serviceModel> 
    <bindings> 
     <basicHttpBinding> 
      <binding name="BasicHttpBinding_IMyExternalService" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
       useDefaultWebProxy="true"> 
       <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
       <security mode="None"> 
        <transport clientCredentialType="None" proxyCredentialType="None" 
         realm="" /> 
        <message clientCredentialType="UserName" algorithmSuite="Default" /> 
       </security> 
      </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="http://myserver.somesdomain.com/Services/MyExternalService.svc" 
      binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IMyExternalService" 
      contract="IMyInternalService" name="BasicHttpBinding_IMyExternalService" /> 
    </client> 
</system.serviceModel> 

什麼我需要做的正確這樣組裝起來的配置。我不想通過http公開InternalInterfaceService。我在這裏做錯了什麼?任何提示或建議,當然讚賞。

感謝,
〜CK

回答

2

你需要一個路由服務 - 一個是暴露了一個HTTP端點走向世界,並使用netTcp內部。

基本上,你面向外部的http服務必須成爲一個客戶端來調用內部netTcp服務。

你絕對可以用一點努力做到這一點在.net 3.5:

,或者你可以在.NET 4中使用新的WCF 4路由服務/ VS 2010:

+0

大部分問題在於配置文件被錯誤地部署到生產環境。 – Hcabnettek 2010-06-02 21:07:02