2012-04-25 19 views
1

ファイアウォールの背後にあるサーバーでスタンドアロンWCFサービスを実行しています。サービスがコールバックを利用するため、現在はwsDualHttpBindingを使用しています。クライアントはLAN環境で正常に動作します。ファイアウォールを開いてカスタムポート上のトラフィックを許可し、サービスの検出が外部LANから機能するようにしました。WCFがファイアウォールの背後にあるwsDualHttpBindingとnetTcpBindingに関連する

wsDualHttpBindingという性質のため、クライアントが独自のファイアウォールの内側にある場合、これは明らかに機能しません。当然、netTcpBindingはどちらが双方向の問題を解決するべきかを思い浮かばせます。しかし、奇妙なことは、サービス設定XMLがと同じポート(および/または除外wsDualHttpBinding)にnetTcpBindingを含むように更新された場合、サービス検索も機能しなくなることです。

私が紛失しているものが他にもあるかと思います。私はHow to: Use netTcpBinding with Windows Authentication and Message Security in WCF Calling from Windows FormsWindows Communication Foundation QuickStart - Multiple Binding VS2010から設定のための正確なアドバイスに従ってきました。

設定:

<system.serviceModel> 
    <bindings> 
    <netTcpBinding> 
     <binding name="NetTcpBindingEndpointConfig"> 
     <security mode="Message" /> 
     </binding> 
    </netTcpBinding> 
    </bindings> 
    <services> 
    <service name="Service1.Service1.Service"> 
     <endpoint address="Service1" binding="wsDualHttpBinding" contract="Service1.IService1"> 
     <identity> 
      <dns value="localhost"/> 
     </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/> 
     <endpoint address="" binding="netTcpBinding" 
       bindingConfiguration="NetTcpBindingEndpointConfig" 
       name="NetTcpBindingEndpoint" contract="Service1.IService1"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
     <host> 
     <baseAddresses> 
      <add baseAddress="http://localhost:9999/Service1.Service1/"/> 
      <add baseAddress="net.tcp://localhost:9999/Service1.Service1/" /> 
     </baseAddresses> 
     </host> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior> 
     <!-- To avoid disclosing metadata information, 
     set the value below to false and remove the metadata endpoint above before deployment --> 
     <serviceMetadata httpGetEnabled="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="True"/> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 
+0

サービスの検出とはどういう意味ですか? WCF 4のWS-Discoveryメカニズムを使用していますか? –

+0

いいえ、間違った言葉を使用した可能性があります。 「発見」では、サービス参照の追加が成功したということを意味していました。 – wpfwannabe

+0

サービスの設定全体を表示します。 –

答えて

2

あなただけの単一のポートを使用することができますし、あなたのサービスをこのように設定しようnetTcpBindingを使用する必要がある場合:

<system.serviceModel> 
    <bindings> 
    <netTcpBinding> 
     <binding name="NetTcpBindingEndpointConfig"> 
     <security mode="Message" /> 
     </binding> 
    </netTcpBinding> 
    </bindings> 
    <services> 
    <service name="Service1.Service1.Service"> 
     <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/> 
     <endpoint address="" binding="netTcpBinding" 
       bindingConfiguration="NetTcpBindingEndpointConfig" 
       name="NetTcpBindingEndpoint" contract="Service1.IService1"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
     <host> 
     <baseAddresses> 
      <add baseAddress="net.tcp://localhost:9999/Service1.Service1/" /> 
     </baseAddresses> 
     </host> 
    </service> 
    </services> 
    <behaviors> 
    <serviceBehaviors> 
     <behavior> 
     <serviceMetadata httpGetEnabled="False"/> 
     <serviceDebug includeExceptionDetailInFaults="True"/> 
     </behavior> 
    </serviceBehaviors> 
    </behaviors> 
</system.serviceModel> 

サービス参照を追加する場合は、このアドレスを使用するようにしてください:

net.tcp://localhost:9999/Service1.Service1/mex 
+0

私は特定のシナリオにはいくつかのサービスが束にホストされていたので、明らかにポートの競合があったことを追加しましょう。幸いにも、私は[this](http://connect.microsoft.com/VisualStudio/feedback/details/286744/port-sharing-mextcpbinding-and-nettcpbinding-fails-when-maxconnections-or-listenbacklog-is-adjusted)を見つけました。これは私の 'binding'に' portSharingEnabled = "true" 'が必要であることを実感しました。私は 'mex'も同じ共有' netTcpBinding'を使うように変更しました。 – wpfwannabe

関連する問題