We use ServiceHost for Years now for local communication between our applications.
We open a net.pipe: net.pipe://localhost/OurCompanyName/
This worked well until the windows 10 patch KB4480966 arrived.
This is the code that opens the service host:
NetNamedPipeBinding binding = new NetNamedPipeBinding();
binding.MaxConnections = 100;
binding.MaxReceivedMessageSize = int.MaxValue;
binding.Security.Mode = NetNamedPipeSecurityMode.Transport;
binding.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;
//binding.ReceiveTimeout = new TimeSpan(0, 0, 10, 0);
this.serviceHost = new ServiceHost(typeof(LocalService), new Uri[] { new Uri(hostBaseAddress) });
this.serviceHost.AddServiceEndpoint(typeof(ILocalService), binding, localServiceEndPointAddress);
foreach (ServiceEndpoint ep in this.serviceHost.Description.Endpoints)
{
foreach (OperationDescription op in ep.Contract.Operations)
{
DataContractSerializerOperationBehavior dataContractBehavior =
op.Behaviors.Find<DataContractSerializerOperationBehavior>()
as DataContractSerializerOperationBehavior;
if (dataContractBehavior != null)
{
dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
}
}
}
this.serviceHost.Open();
Since the mentioned Patch we get this Exception:
Cannot listen on pipe name 'net.pipe://localhost/OurCompanyName/' because another pipe endpoint is already listening on that name.