1

WCFベースの名前付きパイプエンドポイントを使用してWindowsフォーム(通知トレイ)アプリケーションと通信するWindowsサービスで奇妙な問題に直面しています。(。NetFramework 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).
4

1 に答える 1

2

この問題はセキュリティの文脈に関係していると思います。セキュリティコンテキスト「SYSTEM」で実行されたサービスは、セットアップがUACポップアップで特権を昇格させ、その結果WindowsサービスとWinForm( Namedpipe)が実行されたため、セットアップのインストール直後に「名前付きパイプ」サービスのエンドポイントを見つけることができました。ホスト)アプリケーションが同じセキュリティコンテキストで使用されているため、エンドポイントが見つかりました。再起動時に、Winformアプリケーションはログインユーザーのセキュリティコンテキストの下にありましたが、サービスは同じセキュリティコンテキストの下にとどまりました。これにより、「NamedPipe」はサービスとは別のセキュリティコンテキストでホストされていました。そして、サービスは、今回はそうではなかったセキュリティコンテキストに該当するエンドポイントを見つけようとしました。したがって、例外。

于 2013-01-10T11:40:35.453 に答える