Question

Update 20121214 consultation with the developers of the conflict service, they use net.pipe://echonet as service address, and use DuplexChannelFactory. why it will block my Pipe?


Question:

I have a very simple WCF application. Service and Client through NetNamedPipe communication. But it is strange , some machines may be the reason because other software, resulting in the ChannelFactory began to call the Service, throw an exception : System.ServiceModel.ProtocolException .

How could I know which application catch my WCF message, and how should I avoid this problem.

here is exception:

System.ServiceModel.ProtocolException: The requested upgrade is not supported by 'net.pipe://localhost/xxxx/xxxx'. This could be due to mismatched bindings (for example security enabled on the client and not on the server)

Server stack trace: 
  System.ServiceModel.Channels.ConnectionUpgradeHelper.DecodeFramingFault(ClientFramingDecoder decoder, IConnection connection, Uri via, String contentType, TimeoutHelper& timeoutHelper)
  System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.SendPreamble(IConnection connection, ArraySegment`1 preamble, TimeoutHelper& timeoutHelper)
  System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.DuplexConnectionPoolHelper.AcceptPooledConnection(IConnection connection, TimeoutHelper& timeoutHelper)
  System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout)
  System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout)
  System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
  System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
  System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
  System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
  System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
  System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
  System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
  System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
  System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
  System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
  xxx.xxxxx.Communication.Contracts.IxxxComClientService.Register(ClientInfo clientInfo)
  xxx.xxxxx.Communication.xxxComClient.ActionClientRegisterOnlineClientInfo(IxxxComClientService channel)
  xxx.xxxxx.Communication.xxxComClient.ActionReceivedClientOnline(EndpointAddress endpoint)

here is my code'

----------------------------Service------------------------------

 using (var host = new ServiceHost(typeof(StringReverser), new[] { new Uri("net.pipe://localhost") }))
 {
     host.AddServiceEndpoint(typeof(IStringReverser), new NetNamedPipeBinding(), "PipeReverse");
     host.Open();

     Console.WriteLine("Service is available. Press <ENTER> to exit.");
     Console.ReadLine();

     host.Close();
  }

--------------------------Client---------------------------------

var pipeFactory = new ChannelFactory<IStringReverser>(new NetNamedPipeBinding(), new EndpointAddress("net.pipe://localhost/PipeReverse"));
Console.WriteLine("pipeFactory Created. Press <Exit> to exit");
var pipeProxy = pipeFactory.CreateChannel();
Console.WriteLine("pipeProxy Created.");

while (true)
{
   var str = Console.ReadLine();
   Console.WriteLine("pipe: " + pipeProxy.ReverseString(str));
}
Était-ce utile?

La solution

  • b1. the service, is host on windowsservice,run as administrator
  • b2. the service, is set net.pipe://echonet as his address
  • b3. my service, is self host,run as localuser

windowsservice > localuser so, namedpipe will redirect to the service.

  • s1. stop the service
  • s2. change my service host, let it host on windowsservice.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top