1

競合サービスの開発者との20121214 の更新の協議では、 net.pipe://echonetをサービス アドレスとして使用し、DuplexChannelFactoryを使用します。なぜ私のパイプをブロックするのですか?


質問:

非常に単純な WCF アプリケーションがあります。NetNamedPipe 通信によるサービスとクライアント。しかし、奇妙なことに、一部のマシンが原因である可能性があります。これは、他のソフトウェアが ChannelFactory を呼び出してサービスを呼び出し始め、例外 System.ServiceModel.ProtocolException をスローするためです。

どのアプリケーションが自分の WCF メッセージをキャッチしたかを知る方法と、この問題を回避する方法を教えてください。

ここに例外があります:

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)

これが私のコードです」

- - - - - - - - - - - - - - サービス - - - - - - - - - - - ----------

 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();
  }

- - - - - - - - - - - - - クライアント - - - - - - - - - - - - ----------

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));
}
4

1 に答える 1

0
  • b1。サービスは、windowsserviceでホストされ、管理者として実行されます
  • b2。サービスは、彼のアドレスとしてnet.pipe://echonetに設定されています
  • b3。私のサービスはセルフホストで、localuserとして実行されます

windowsservice> localuserなので、namedpipeはサービスにリダイレクトします。

  • s1。サービスを停止します
  • s2。サービスホストを変更し、Windowsサービスでホストします。
于 2012-12-14T08:02:59.617 に答える