user2347528
user2347528

Reputation: 610

How to have a WPF application on two different machines in the same network

I have a WPF application on two windows machines connected in the same network. The two systems are for redundancy purposes. Initially the app on machine1 keeps running. When machine1 is down for any reason, I want to start the app on machine2. How can the app on both machines check for heartbeat of the each other? How can the app on the other machine be started when there is no heartbeat from the other?

1) The app gets info from one web service and sends it to another web service every x minutes. It is important that the info flow is not paused. Very often the machines have to be updated for maintenance or may get disconnected or accidentally shutdown. In that case, I wanted to have another machine ready to run the app meanwhile.

2) Other than these two machines, I do not have another machine to run SQL Server.

Upvotes: 1

Views: 371

Answers (1)

Ralf de Kleine
Ralf de Kleine

Reputation: 11734

@user2347528, I can provie some direction. Although the answer is as good as your question is. Can you provide more info on:

  • What is the problem you need this solution for
  • Do you have a SQL Server running?
  • Does your application crash or are the terminals/servers unexpectedly shutting down or option c?

Possible solution:

1.Start application on both machines. Easy one.

2.Let the application set a date value + machinename in some database table (or plain text file, or whatever means to a purpose)

3.Create a table named AppLive CREATE TABLE [dbo].[AppLive]( [MachineName] nvarchar NOT NULL, [Ping] [datetime] NOT NULL CONSTRAINT [PK_dbo.AppLive] PRIMARY KEY CLUSTERED ( [MachineName] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]

4.Check some database table (or plain text file, or whatever means to a purpose) if the application is live on some machine. If so set app in 'wait'-mode, if not set app in 'live'-mode.

Upvotes: 1

Related Questions