0

I have one WCF service in which I have some methods. One method name is KilProcess(), which kills the Windows process created and it contains the code

public void KilProcess()
{

    Process.GetCurrentProcess().Kill();
}

It's working in my machine but in client machine (high config machine) this WCF service is getting stopped and throwing the exception

2016-09-15 16:08:11,789 INFO [stdout] (default task-120) 1473948491783 SystemLog 1473948491078 ScriptEngine-There was no endpoint listening at net.pipe://localhost/MyService that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. 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 Myprod.TestFacade.Interface.IScriptProcess.UnregisterProcess(Int32 ProcessId, String taskId) at Program.KillProcess()..

Can anyone have any idea why it is (WCF service) stopping ?

Tim
  • 28,212
  • 8
  • 63
  • 76
user1435149
  • 11
  • 1
  • 3
  • The error message is quite clear - there was no endpoint listening at `net.pipe://localhost/MyService`. Is the client on the same machine as the service (it must be to use net.pipe)? Is the service running when you try to connect? – Tim Sep 19 '16 at 17:27

2 Answers2

1

First, you have to know that net.pipes are for interprocess communication only (2 process on the same machine). You also have to tell us more details about what you are trying to do. In your explications, it looks like you are using two different machines, right? Then net.tcp insteed of pipe is what you are looking for (https://msdn.microsoft.com/en-us/library/ff649818.aspx)

But if it's not the case, try to give us more details, the context and your WCF configuration files is a good start.

Ahonir
  • 142
  • 1
  • 6
1

You didn't give a lot details about your code or client/server setup, so my answer will be kind of general. If it's running fine on your machine but not on a client machine, here a couple of things you can check:

  1. Named pipes is a method for accomplishing Inter-Process Communication (IPC), where (at least for WCF) your named pipes server (in this case, your WCF service) must be on the same machine as your client. As a side note though, Named Pipes can be used to communicate between computers across a network, but this is not the case for WCF's implementation of Named Pipes, where the server and client must be confined to the same machine.

  2. You can use Process Explorer (https://technet.microsoft.com/en-us/sysinternals/processexplorer.aspx) to troubleshoot and make sure the named pipe server endpoint is alive. Just go to Find->Find handle or dll and search using the name of your named pipe. The tricky part with this is that the actual named pipe name is actually a guid generated by Windows. Check out this interesting article to find out how to get the actual name of your pipe: https://blogs.msdn.microsoft.com/rodneyviana/2011/03/22/named-pipes-in-wcf-are-named-but-not-by-you-and-how-to-find-the-actual-windows-object-name/

  3. Is your server and client running on different security contexts? Check out Chris Dickson's answer to this SO question: Named pipe not found when using WCF netNamedPipeBinding. He gives on explanation on why a client might fail to find the named pipe if it's running in a different context.

jack_bauer
  • 45
  • 6