5

ユーザーが登録して、イベントが発生したときに通知を受け取ることができるサービスを作成しています。netTcpBinding でこれを実行しようとしていますが、ローカル マシンで実行している場合でもエラーが発生し続けます。

通知を送信しようとすると、タイムアウトになり、次のエラーが発生します。

http://www.w3.org/2005/08/addressing/anonymousでStream Security が必要ですが、セキュリティ コンテキストがネゴシエートされていません。これは、リモート エンドポイントがそのバインディングから StreamSecurityBindingElement を欠いていることが原因である可能性があります。

テストのために、コンソールでサービスをホストしています。コンソールが開き、WSDL を確認して svcutil を実行できます。ただし、クライアントを実行して通知を送信しようとすると、上記のエラーが表示されます。

ホスト App.config:

<system.serviceModel>
<services>
  <service name="CompanyName.WebServices.InterventionService.RegistrationService"
           behaviorConfiguration="RegistrationServiceBehavior">
    <endpoint address="http://localhost:8000/CompanyName/Registration"
              binding="wsDualHttpBinding"
              contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/>
    <endpoint address="net.tcp://localhost:8001/CompanyName/Registration"
              binding="netTcpBinding"
              contract="CompanyName.WebServices.InterventionService.Interfaces.IRegistrationService"/>
  </service>
  <service name="CompanyName.WebServices.InterventionService.NotificationService"
           behaviorConfiguration="NotificationServiceBehavior">
    <endpoint address="http://localhost:8010/CompanyName/Notification"
              binding="wsDualHttpBinding"
              contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/>
    <endpoint address="net.tcp://localhost:8011/CompanyName/Notification"
              binding="netTcpBinding"
              contract="CompanyName.WebServices.InterventionService.Interfaces.INotificationService"/>
  </service>
</services>
<behaviors>
  <serviceBehaviors>
    <behavior name="RegistrationServiceBehavior">
      <serviceMetadata httpGetEnabled="true"
                       httpGetUrl="http://localhost:8000/CompanyName/Registration"/>
    </behavior>
    <behavior name="NotificationServiceBehavior">
      <serviceMetadata httpGetEnabled="true"
                       httpGetUrl="http://localhost:8010/CompanyName/Notification"/>
    </behavior>
    <behavior name="netTcpRegistrationServiceBehavior">
      <serviceMetadata httpGetEnabled="true"
                       httpGetUrl="net.tcp://localhost:8001/CompanyName/Registration"/>
    </behavior>
    <behavior name="netTcpNotificationServiceBehavior">
      <serviceMetadata httpGetEnabled="true"
                       httpGetUrl="net.tcp://localhost:8011/CompanyName/Notification"/>
    </behavior>
  </serviceBehaviors>
</behaviors>

クライアントの App.config は次のとおりです。

<system.serviceModel>
<bindings>
  <netTcpBinding>
    <binding name="NetTcpBinding_IRegistrationService">
      <security mode="None">
        <message clientCredentialType="None"/>
        <transport clientCredentialType="None"/>
      </security>
    </binding>
    <binding name="NetTcpBinding_INotificationService">
      <security mode="None">
        <message clientCredentialType="None"/>
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </netTcpBinding>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_IRegistrationService">
      <reliableSession ordered="true"/>
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false"/>
      </security>
    </binding>
    <binding name="WSDualHttpBinding_INotificationService">
      <reliableSession ordered="true"/>
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false"/>
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>
<client>
  <endpoint address="http://localhost:8000/GPS/Registration"
            binding="wsDualHttpBinding"
            bindingConfiguration="WSDualHttpBinding_IRegistrationService"
            contract="IRegistrationService"
            name="WSDualHttpBinding_IRegistrationService">
  </endpoint>
  <endpoint address="net.tcp://localhost:8001/GPS/Registration"
            binding="netTcpBinding"
            bindingConfiguration="NetTcpBinding_IRegistrationService"
            contract="IRegistrationService"
            name="NetTcpBinding_IRegistrationService">
  </endpoint>
  <endpoint address="http://localhost:8010/GPS/Notification"
            binding="wsDualHttpBinding"
            bindingConfiguration="WSDualHttpBinding_INotificationService"
            contract="INotificationService"
            name="WSDualHttpBinding_INotificationService">
  </endpoint>
  <endpoint address="net.tcp://localhost:8011/GPS/Notification"
            binding="netTcpBinding"
            bindingConfiguration="NetTcpBinding_INotificationService"
            contract="INotificationService"
            name="NetTcpBinding_INotificationService">
  </endpoint>
</client>

現在、通知を機能させようとしているだけなので、多くの登録コードを省略しました。

顧客のドメイン (顧客のセットアップ) の一部ではない 2003 Server の Windows サービスでこれをホストする計画であり、クライアント コンピュータは顧客のドメインにあります。

編集:

ホストの App.config にバインディングを追加しました。

<bindings>
  <netTcpBinding>
    <binding name="NetTcpBinding_IRegistrationService">
      <security mode="None">
        <message clientCredentialType="None"/>
        <transport clientCredentialType="None"/>
      </security>
    </binding>
    <binding name="NetTcpBinding_INotificationService">
      <security mode="None">
        <message clientCredentialType="None"/>
        <transport clientCredentialType="None"/>
      </security>
    </binding>
  </netTcpBinding>
  <wsDualHttpBinding>
    <binding name="WSDualHttpBinding_IRegistrationService">
      <reliableSession ordered="true"/>
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false"/>
      </security>
    </binding>
    <binding name="WSDualHttpBinding_INotificationService">
      <reliableSession ordered="true"/>
      <security mode="None">
        <message clientCredentialType="None" negotiateServiceCredential="false"/>
      </security>
    </binding>
  </wsDualHttpBinding>
</bindings>

これでもエラーが発生し、同じ Steam Security is required エラー メッセージが表示されます。このアプリの小さなサブセットを新しいソリューションで試しています。

4

2 に答える 2

10

さて、あなたの問題はこれのようです:

  • サーバー側では、パラメーターなしでデフォルトの netTCP バインディングを使用します。何も変更しません。netTCP はデフォルトで、Windows 資格情報を使用したトランスポート レベルのセキュリティに設定されます

  • ただし、クライアントでは、netTCP バインディングのセキュリティを明示的にオフにします

そのため、両者は一致せず、何をすべきかについて意見が一致しません。

サーバーとクライアントの両方のエンドですべてのセキュリティを無効にするか、(Windows 資格情報を使用して) 安全な既定値を使用する必要があります。

マルク

于 2009-05-14T19:24:30.443 に答える
3

これは、さまざまな方向に導く恐ろしいエラー メッセージの 1 つだと思います。上記の答えはその場合に正しいです。私の場合は異なりました - 私のセキュリティ設定はクライアントとサーブで同じでした。

私の場合、このリンクは私の特定の欠陥を指摘しました: http://www.netframeworkdevs.com/windows-communication-foundation-wcf/error-invoking-service-with-a-net-tcp-binding-123918.shtml

エンドポイントのサービス側の app.config にはbindingName、バインディング構成に名前を付けるための属性がありました... ではなくbindingConfiguration. にbindingNameという名前の属性さえないと思いますendpoint

だから...私の持ち帰りは、このエラーは「WCF構成エラーがある」ことを意味し、おそらくサービス側の構成に絞り込まれているということです。うーん。

于 2012-05-27T16:06:21.943 に答える