locked
WCF over named pipes RRS feed

  • Question

  • Hi I have a problem with following scenario:

    There is a windows service running which spawns several processes. These processes open a WCF service host over a named pipe binding. Now the parent windows service tries to ping (connect) to the child processes using the wcf proxy over the well known named pipe. This, however fails saying: "Endpoint not found"

    If I run the parent process as a console application it works fine.

    Any ideas? I was thinking about permissions but the child processes should inherit the permission of the service, besides they are in the same session as well.

    thanks, Christoph

    Tuesday, October 13, 2009 4:09 PM

Answers

  • Hi Christoph,

    Please use BasicHttpBinding to test. I use this binding to implement your requirement without any problem. Commonly you need to note security configuration with namedpipebinding.

    namespace SimpleWSTest
    {
        public partial class MyWServiceTest : ServiceBase
        {
            public MyWServiceTest()
            {
                InitializeComponent();
                if (!System.Diagnostics.EventLog.SourceExists("DoDyLogSoursetest"))
                    System.Diagnostics.EventLog.CreateEventSource("DoDyLogSoursetest",
                                                                          "DoDyLogtest");

                eventLog1.Source = "DoDyLogSoursetest";
                // the event log source by which

                //the application is registered on the computer

                eventLog1.Log = "DoDyLogtest";

            }

            protected override void OnStart(string[] args)
            {
                Process.Start(@"C:\ConsoleApplication18\ConsoleApplication18\bin\Debug\ConsoleApplication18.exe");
            }

            protected override void OnStop()
            {
                try
                {
                    ServiceReference1.SimpleServiceClient sc = new ServiceReference1.SimpleServiceClient();
                    sc.Open();
                    string sr = sc.SimpleMethod("test");
                    eventLog1.WriteEntry(sr);
                    sc.Close();
                }
                catch (Exception ex)
                {
                    eventLog1.WriteEntry(ex.Message);
                }
            }
            protected override void OnContinue()
            {
              
            }

        }
    }

    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Riquel_Dong Tuesday, October 20, 2009 8:08 AM
    Tuesday, October 20, 2009 8:08 AM
  • Sorry for wasting your time (and mine as well ;) ) it was a bad mistake. The problem was that I didn't give the child process enough time to open the host. How would have thought that 15 seconds is not enought to spawn a process which opens a WCF endpoint....

    Anyway, thanks for your help!
    • Marked as answer by Riquel_Dong Wednesday, October 21, 2009 3:20 AM
    Tuesday, October 20, 2009 5:59 PM

All replies

  • Hi Balistof,

    If you expose the metadata via Http which is hosted in child process of that Windows service, whether you can view the metadata in the web browser. If you can, you write one Windows Form WCF client to see whether you can communicate between the service and client.

    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, October 16, 2009 8:34 AM
  • Hi Christoph,

    Please use BasicHttpBinding to test. I use this binding to implement your requirement without any problem. Commonly you need to note security configuration with namedpipebinding.

    namespace SimpleWSTest
    {
        public partial class MyWServiceTest : ServiceBase
        {
            public MyWServiceTest()
            {
                InitializeComponent();
                if (!System.Diagnostics.EventLog.SourceExists("DoDyLogSoursetest"))
                    System.Diagnostics.EventLog.CreateEventSource("DoDyLogSoursetest",
                                                                          "DoDyLogtest");

                eventLog1.Source = "DoDyLogSoursetest";
                // the event log source by which

                //the application is registered on the computer

                eventLog1.Log = "DoDyLogtest";

            }

            protected override void OnStart(string[] args)
            {
                Process.Start(@"C:\ConsoleApplication18\ConsoleApplication18\bin\Debug\ConsoleApplication18.exe");
            }

            protected override void OnStop()
            {
                try
                {
                    ServiceReference1.SimpleServiceClient sc = new ServiceReference1.SimpleServiceClient();
                    sc.Open();
                    string sr = sc.SimpleMethod("test");
                    eventLog1.WriteEntry(sr);
                    sc.Close();
                }
                catch (Exception ex)
                {
                    eventLog1.WriteEntry(ex.Message);
                }
            }
            protected override void OnContinue()
            {
              
            }

        }
    }

    Best regards,
    Riquel
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Riquel_Dong Tuesday, October 20, 2009 8:08 AM
    Tuesday, October 20, 2009 8:08 AM
  • Sorry for wasting your time (and mine as well ;) ) it was a bad mistake. The problem was that I didn't give the child process enough time to open the host. How would have thought that 15 seconds is not enought to spawn a process which opens a WCF endpoint....

    Anyway, thanks for your help!
    • Marked as answer by Riquel_Dong Wednesday, October 21, 2009 3:20 AM
    Tuesday, October 20, 2009 5:59 PM