0

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.

Daniel
  • 486
  • 4
  • 19
  • As you know, the third segment of the NetNamedPipe address is the address name, is it possible that the name is occupied and has not been released? Try to change another address. Also I don't see you close the service host in your code snippets. – Abraham Qian Feb 21 '19 at 08:36
  • The host is closed when the application is closed. This is only the opening-part of the code. Thank you for your Advice. – Daniel Feb 21 '19 at 12:17

0 Answers0