Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8632509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:21:47+00:00 2026-06-12T09:21:47+00:00

Hi all i have created a service based application which communicates with a pipe

  • 0

Hi all i have created a service based application which communicates with a pipe
the service application works until the windows application stops which contains the
pipe server code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:21:48+00:00Added an answer on June 12, 2026 at 9:21 am

    Try the following code. You will have to merge this process in the code with whatever code you already have for your service. Replace the “PipeServiceName.exe” to whatever the name of the process is called. Also, this code checks every 5 seconds. You can change this by changing the 5000 number.

    Without knowing more about how the “pipe” and the service interact with each other, its hard to put together a workflow.

    private readonly ManualResetEvent _shutdownEvent = new ManualResetEvent(false);
    private Thread _thread;
    
    public MyService()
    {
        InitializeComponent();
    }
    
    protected override void OnStart(string[] args)
    {
        _thread = new Thread(MonitorThread)
        {
            IsBackground = true
        }
    }
    
    protected override void OnStop()
    {
        _shutdownEvent.Set();
        if (!_thread.Join(5000))
        {
            _thread.Abort();
        }
    }
    
    private void MonitorThread()
    {
        while (!_shutdownEvent.WaitOne(5000))
        {
            Process[] pname = Process.GetProcessesByName("PipeServiceName.exe");
            if (pname.Count == 0)
            {
                 // Process has stopped. ReLaunch
                 RelaunchProcess();
            }
         }
    }
    
    private void RelaunchProcess()
    {
        Process p = new Process();
    
        p.StartInfo.FileName = "PipeServiceName.exe";
        p.StartInfo.Arguments = ""; // Add Arguments if you need them
    
        p.Start();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a WCF Publish/Subscribe service using WSDualHTTPBinding. It allows a server application
I have created an application in facebook,all is working fine except the publish to
I have created an utility function which I include in almost all Javascript code
I have created a QDialog based app using Qt Creator and all is well
I have created an OData/WCF service using Visual Studio 2010 on Windows XP SP3
I have a subscription based MVC 2 application with the basic .NET Membership service
I have a WPF application which talks to a WCF service hosted in IIS.
I have Web application in Cent Os server created in JSP. After some time
I have created a page Education For All in facebook. In my website i
I have created an atlas with all images I will use in a class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.