1

WAS で WCF サービスをホストするのに助けが必要です。IIS でサービスを正常にホストし、basicHttp および wsHttp バインディングを介してアクセスしました。しかし、WAS でホストして tcp/ip 経由でアクセスしようとすると、何かが足りないようです。

ポート 10000 で tcp 経由でアクセスできるように構成する必要があります。

Windows の機能で非 HTTP の WCF アクティベーションを有効にしました

サービスは、デフォルトの Web サイト、アプリケーション mywcfapp で公開されます

以下のように、デフォルトの Web サイトと mywcfapp のポート 10000 で net.tcp バインディングを有効にする BAT ファイルを作成しました。

%windir%\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='10000:*']
%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/mywcfapp" /enabledProtocols:http,net.tcp

web.config は

<services>
  <service name="MyWcfService">
    <clear />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
      listenUriMode="Explicit" />

    <endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
      binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />
    <endpoint address="net.tcp://localhost:10000/mywcfapp/mywcfapp.svc"
      binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="MyApp.IService" />

  </service>
</services>

<bindings>
  <netTcpBinding>
    <binding name="PortSharingBinding" portSharingEnabled="true">
      <security mode="None" />
    </binding>
  </netTcpBinding>
</bindings>

ただし、サービスにアクセスできないようです。

uriでWcfTestClientでサービスにアクセスしようとすると

net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex

次のエラーが表示されます

<Fault xmlns="http://www.w3.org/2003/05/soap-envelope">
<Code>
    <Value>Sender</Value>
    <Subcode><Value xmlns:a="http://www.w3.org/2005/08/addressing">a:DestinationUnreachable</Value>
    </Subcode>
</Code>
<Reason><Text xml:lang="ro-RO">
    The message with To 'net.tcp://localhost:10000/mywcfapp/mywcfapp.svc/mex' 
    cannot be processed at the receiver, due to an AddressFilter mismatch 
    at the EndpointDispatcher.  
    Check that the sender and receiver's EndpointAddresses agree.
</Text></Reason>
</Fault>

URLで接続しようとすると(ポートを指定せずに)

net.tcp://localhost/OneTest.Service/OneTest.Service.svc/mex

エラーが発生します(重要な部分のみを保持)

Could not connect to net.tcp://localhost/mywcfapp/mywcfapp.svc/mex. 
The connection attempt lasted for a time span of 00:00:02.0041146. 
TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:808.     
No connection could be made because the target machine actively refused it 127.0.0.1:808
4

1 に答える 1

3

これは役立つかもしれません:

IIS マネージャーに移動します。アプリを右クリックします。[アプリケーションの管理] -> [詳細設定] を選択します。[動作] の下に、[有効なプロトコル] のフィールドがあります。

あることを確認してくださいnet.tcp

だけの場合はhttp、に変更します

http,net.tcp
于 2011-12-05T19:16:02.893 に答える