0

したがって、2 つの ServiceContracts + MEX を備えた WCF サービスがあります。つまり、3 つのエンドポイントです。

各サービス コントラクトに接続する 2 つのエンドポイントは、netTcpBindingを使用し、同じ を利用しbindingConfigurationます。

1 つの場所から両方のサービスを使用する必要があります。クライアント側の構成は同じですが、プロキシ呼び出し ( contractFilter mismatch) の一方で例外が発生しますが、他方では例外が発生しません。それはどうしてですか。ボットの構成が同じで、両方の構成も同様に機能する場合、一方は機能しますが、もう一方は機能しません。

問題のサービスは Duplex タイプであることに注意してください。

次に、2 つのサービス コントラクトを示します。

[ServiceContract(SessionMode = SessionMode.Required, Name = "VpUser")]
public interface IVpClientService

[ServiceContract(SessionMode = SessionMode.Required, Name = "VpAdmin", CallbackContract = typeof(IAdminCallback))] 
public interface IVpAdminService

[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerSession, ConcurrencyMode = ConcurrencyMode.Multiple, IncludeExceptionDetailInFaults = true)]
public partial class VpService : IVpClientService, IVpAdminService, IServiceBehavior

サービス側の web.config:

<system.serviceModel>
    <diagnostics performanceCounters="Off">
        <messageLogging logEntireMessage="true" logMalformedMessages="false"
        logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="false" />
        <endToEndTracing messageFlowTracing="true" />
    </diagnostics>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    <bindings>
        <netTcpBinding>
            <binding name="VpNetTcpBinding" portSharingEnabled="true"  closeTimeout="00:02:00" openTimeout="00:02:00"
                 receiveTimeout="00:22:00" sendTimeout="00:24:00" maxReceivedMessageSize="131072" >
                <reliableSession enabled="false" inactivityTimeout="00:50:00"/>
                <security mode="Transport"  >
                    <transport clientCredentialType="Windows" />
                </security>
            </binding>
        </netTcpBinding>
        <mexHttpBinding>
            <binding name="mexHttpBinding" closeTimeout="00:02:00" openTimeout="00:02:00"
                 receiveTimeout="00:02:00" sendTimeout="00:02:00" />
        </mexHttpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="VpServiceBehavior" name="VP.VpService.VpService">
            <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="mexHttpBinding"
          name="MexMetadata" contract="IMetadataExchange" listenUriMode="Explicit" />
            <endpoint binding="netTcpBinding" bindingConfiguration="VpNetTcpBinding"
          name="HttpClient" contract="VP.VpService.IVpClientService">
                <identity>
                    <dns />
                </identity>
            </endpoint>
            <endpoint binding="netTcpBinding" bindingConfiguration="VpNetTcpBinding"
          name="HttpAdminClient" contract="VP.VpService.IVpAdminService">
                <identity>
                    <dns />
                </identity>
            </endpoint>
        </service>
    </services>
    <behaviors>
        <serviceBehaviors>
            <behavior name="VpServiceBehavior">
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
                <serviceThrottling
            maxConcurrentCalls="32"
            maxConcurrentSessions="100"
            maxConcurrentInstances="132"
            />
            </behavior>
        </serviceBehaviors>
    </behaviors>
</system.serviceModel>

そしてクライアント側の設定:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="HttpClient" closeTimeout="00:01:00" openTimeout="00:01:00"
                    receiveTimeout="00:06:00" sendTimeout="00:06:00" transactionFlow="false"
                    transferMode="Buffered" transactionProtocol="OleTransactions"
                    hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                    maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="01:01:00"
              enabled="false" />
                <security mode="Transport">
                    <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                    <message clientCredentialType="Windows" />
                </security>
            </binding>
            <binding name="HttpAdminClient" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:06:00" sendTimeout="00:01:00" transactionFlow="false"
            transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10"
            maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
            maxReceivedMessageSize="65536">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="01:01:00"
                           enabled="false" />
                <security mode="Transport">
                    <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                    <message clientCredentialType="Windows" />
                </security>
            </binding>
        </netTcpBinding>
    </bindings>
    <client>
        <endpoint address="net.tcp://MyDomain:443/SubDomain/vpservice.svc"
            binding="netTcpBinding" bindingConfiguration="HttpClient"
            contract="VPService.VpUser" name="HttpClient">
            <identity>
                <dns />
            </identity>
        </endpoint>
        <endpoint address="net.tcp://MyDomain:443/SubDomain//vpservice.svc"
          binding="netTcpBinding" bindingConfiguration="HttpAdminClient"
          contract="VPService.VpAdmin" name="HttpAdminClient">
            <identity>
                <dns />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>

HTTP 名のプレフィックスは、netTcp に変更される前からレガシーであることに注意してください。

したがって、プロキシを構築できますopen()が、いくつかの非同期呼び出し (管理クライアントに 1 つ、もう 1 つに 2 つ) を行うとすぐに、管理者で Contract Mismathc 障害が発生しますが、他の 2 つは正常に実行されます。

それはどうしてですか?

4

0 に答える 0