バインディングのプログラムによる構成で多くの試行錯誤を繰り返した後、最終的に問題を解決しました。
を作成したときに生成されたバインディング スタック内の何かNetTcpBinding
により、複数NetTcpBinding
の がポートを共有できるようになっているようです。問題は、カスタム バインディングを作成する必要があることでした。
解決策は、に基づいてNetTcpBinding
カスタムバインディングを作成することになりました。例えば:
var lBinding = new NetTcpBinding()
{
SendTimeout = TimeSpan.FromMinutes(5),
ReceiveTimeout = TimeSpan.FromMinutes(5),
MaxConnections = 100,
ReliableSession = new OptionalReliableSession
{
Enabled = true,
Ordered = true,
InactivityTimeout = TimeSpan.FromMinutes(30)
},
Security = new NetTcpSecurity
{
Mode = SecurityMode.TransportWithMessageCredential,
Message = new MessageSecurityOverTcp { ClientCredentialType = MessageCredentialType.UserName }
},
MaxReceivedMessageSize = 524288
};
var lCustomBinding = new CustomBinding(lBinding);
// Edit the custom binding elements here
var lEndpoint = new ServiceEndpoint(lContract, lCustomBinding, new EndpointAddress(pServiceHost.BaseAddresses.First()));