2010-11-24 10 views
3

WindowsサービスにWCFサービスが組み込まれています。これはlocalhostにバインドされていますが、 "http:// ip:port/ServiceName"という種類のURLからの接続も受け入れます。私はNetNamedPipeBindingに切り替えるでしょう。ここWCFサービスを非表示にする方法

は私のサービス構成

<system.serviceModel> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="Test.Service.ServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
<services> 
    <service behaviorConfiguration="Test.Service.ServiceBehavior" name="Test.Service.TestService"> 
     <endpoint address="localhost" binding="wsHttpBinding" contract="Test.Service.IService"> 
     <identity> 
      <dns value="localhost" /> 
     </identity> 
     </endpoint> 
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     <host> 
     <baseAddresses> 
       <add baseAddress="http://localhost:8732/MyService/service" /> 
     </baseAddresses> 
     </host> 
    </service> 
</services> 
</system.serviceModel> 

答えて

6

あなたが任意のメタデータ交換をオフにする必要があるので、あなたは削除する必要があり、それを「非表示」にするに:

<serviceMetadata httpGetEnabled="true" /> 

をご利用のサービスの行動から、あなたがMEXエンドポイントを削除する必要があります。

<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 

しかし、これはそれを「隠す」だけです。 localhost以外の誰かを避けるには、netNamedPipeBindingに "なぜならこのマシンのみ"に切り替えるのはなぜですか?外部の発信者はそのエンドポイントに電話をかけることができません。

そうでなければ、発信者のIPアドレスをチェックし、その情報に基づいてそれらをブロックする必要があるだろう - しかし、かなり簡単に詐称できる....

+0

助けてくれてありがとう) – mironych

1

である - これは本質的にローカルのみですが、また、いくつかの追加の層を回避し、そして(これ以外の任意のポートへのアクセスを必要としません。管理者はデフォルトでは持っていません)。これは、<netNamedPipeBinding>要素を使用して設定することができます。

0

あなたがIISでホスティングされている場合は、あなただけの可能性サイトのバインディングを「*」から「127.0.0.1」に変更してください

関連する問題