【问题标题】:No endpoint of WCF based Named Pipe service for specific application特定应用程序没有基于 WCF 的命名管道服务的端点
【发布时间】:2013-01-03 14:13:27
【问题描述】:

我在使用基于 WCF 的命名管道端点(.Net Framework 4.0)与 Windows 窗体(通知托盘)应用程序通信时遇到一个奇怪的问题。(.Net Framework 4.0)

安装设置后,该服务会正确地将消息发送到我的 winform(通知托盘)应用程序,并且它可以按预期工作。

但是一旦我重新启动机器。服务找不到 Namedpipe 端点。我尝试通过从 VS 2010 创建另一个应用程序来发送消息,它能够将消息发送到我的 Windows 窗体(通知托盘)应用程序。

windows服务抛出的异常是

 There was no endpoint listening at net.pipe://localhost/Pipe/Pipe1 that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Error innerException : System.IO.PipeException: The pipe endpoint 'net.pipe://localhost/Pipe/Pipe1' could not be found on your local machine.
Error stackStrace : Server stack trace: at System.ServiceModel.Channels.PipeConnectionInitiator.GetPipeName(Uri uri, IPipeTransportFactorySettings transportFactorySettings) at System.ServiceModel.Channels.NamedPipeConnectionPoolRegistry.NamedPipeConnectionPool.GetPoolKey(EndpointAddress address, Uri via) at System.ServiceModel.Channels.CommunicationPool`2.TakeConnection(EndpointAddress address, Uri via, TimeSpan timeout, TKey& key) at System.ServiceModel.Channels.ConnectionPoolHelper.EstablishConnection(TimeSpan timeout) at System.ServiceModel.Channels.ClientFramingDuplexSessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at NamedPipe.Communication.IPipeService.PipeIn(String data) at NamedPipe.Sender.SendMessage(String messages, String PipeName) at NamedPipe.Sender.SendMessage(String messages).

【问题讨论】:

  • 你的winform应用程序运行了吗?
  • 是的,我的 winform 应用程序正在运行,它也显示在托盘图标中。当命名管道从控制台应用程序或其他应用程序(机器重新启动时,即 Windows 服务无法通信时)命中时,它还会显示通知气球。

标签: .net wcf windows-services


【解决方案1】:

我认为该问题与安全上下文有关。在安全上下文“SYSTEM”下运行的服务可以在安装程序安装后立即找到“命名管道”服务的端点,因为安装程序通过 UAC 弹出窗口提升其权限,从而运行 Windows 服务和 WinForm(Namedpipe Host) 应用程序在相同的安全上下文下,因此找到了端点。重新启动后,尽管 Winform 应用程序位于登录用户的安全上下文中,但服务仍处于相同的安全上下文中,这导致“NamedPipe”托管在与服务不同的安全上下文中。并且该服务试图找到落入其安全上下文中的端点,但这次不是。因此出现“未找到端点”异常。

【讨论】:

    猜你喜欢
    • 2016-09-22
    • 2011-09-11
    • 2014-05-18
    • 1970-01-01
    • 1970-01-01
    • 2018-05-17
    • 2011-10-04
    • 1970-01-01
    • 2021-08-22
    相关资源
    最近更新 更多