0

プリンシパルをデュプレックスにしたいサービスがありますが、一部の操作ではストリーミング転送モードを使用する必要があるため、2 つのコントラクトが必要です。1 つは一般的なコントラクトです。データベースを作成し、必要に応じてサービスからクライアントにメッセージを送信し、ファイルと対話し、ファイルをデータベースに保存して取得するための他の契約。

tcp バインディングはデュプレックスと互換性がないため、2 つのコントラクトが必要です。

サービスは WPF アプリケーションでホストされ、構成ファイルは次のとおりです。

<system.serviceModel>
    <services>          
      <service name="GTS.CMMS.Service.Service" behaviorConfiguration="behaviorConfig">
        <host>
          <baseAddresses>

            <add baseAddress="net.tcp://localhost:7997/CMMSHost"/>
            <add baseAddress="http://localhost:7998/CMMSHost"/>
          </baseAddresses>
        </host>   


        <endpoint address="/ServiceCore"
                  binding="netTcpBinding"
                  bindingConfiguration="tcpBinding"
                  name="ServiceCore"
                  contract="GTS.CMMS.Service.IService">
          <!--<identity>
            <dns value="localhost" />
          </identity>-->
        </endpoint>


        <endpoint address="/ServiceDocumentos"
                  binding="netTcpBinding"
                  bindingConfiguration="tcpBindingDocumentos"
                  name="ServiceDocumentos"
                  contract="GTS.CMMS.Service.IServiceDocumentos">
          <!--<identity>
            <dns value="localhost" />
          </identity>-->
        </endpoint>


        <endpoint contract="IMetadataExchange" binding="mexTcpBinding" address="net.tcp://localhost:5000/mex" />
      </service>      
    </services>


    <!--El behavior son datos de configuración del servicio que no forman parte del endpoint.
    Por ejemplo, si el servicio da una excepción, se querrá informar al cliente.-->
    <behaviors>
      <serviceBehaviors>
        <behavior name="behaviorConfig">
          <serviceMetadata httpGetEnabled="true" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <!--Necesario para poder mandar excepciones desde el servicio hasta el cliente.-->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
        </behavior>


        <behavior name="behaviorConfigDocumentos">
          <!--<serviceMetadata httpGetEnabled="true" />-->
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          <!--Necesario para poder mandar excepciones desde el servicio hasta el cliente.-->
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100" />
          <serviceMetadata/>
        </behavior>
      </serviceBehaviors>
    </behaviors>


    <!--Se necesita la configuración del binding para que funcione correctamente la comunicación entre el cliente y el servidor.-->
    <bindings>
      <netTcpBinding>
        <!--Se configura el binding que se utilizará para el endPoint ChatServiceAssembly.IChat-->
        <binding name="tcpBinding" maxBufferSize="67108864"
                      maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
                       transferMode="Buffered" closeTimeout="00:00:10"
                       openTimeout="00:00:10" receiveTimeout="00:20:00"
                       sendTimeout="00:01:00" maxConnections="100">
          <security mode="None"/>
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
              maxArrayLength="2147483647" maxBytesPerRead="2147483647"
              maxNameTableCharCount="2147483647"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00" />
        </binding>


        <binding name="tcpBindingDocumentos" maxBufferSize="67108864"
                      maxReceivedMessageSize="67108864" maxBufferPoolSize="67108864"
                       transferMode="Streamed" closeTimeout="00:00:10"
                       openTimeout="00:00:10" receiveTimeout="00:20:00"
                       sendTimeout="00:01:00" maxConnections="100">
          <security mode="None"/>
          <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
              maxArrayLength="2147483647" maxBytesPerRead="2147483647"
              maxNameTableCharCount="2147483647"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00" />
        </binding>
      </netTcpBinding>

    </bindings>
  </system.serviceModel>

すべてが機能するかどうかを確認するために、Internet Explorer に移動して次の場所に移動します。

http://localhost:7998/CMMSHost

2 つのエンドポイントがある場合、ページは見つかりませんが、2 番目のエンドポイント「/ServiceDocumentos」にコメントすると、ページが見つかり、svcutil を使用してプロキシを作成できます。

多数のエンドポイントを構成するにはどうすればよいですか?

ありがとう。

4

0 に答える 0