Jonnster
Jonnster

Reputation: 3214

C# Windows Service Running On Multiple Machines?

I am trying to create a WCF service which is hosted within a windows service. This windows service will be deployed on multiple machines (a variable number of machines depending on load). There will be a business layer which will be queuing "jobs" and passing each job to one of these windows services depending on which one is free.

I am a bit confused on how to achieve this. Do I write the WCF and hosting windows service, install them on to whichever machines I require. Then from the layer which will despatch the jobs to these services, I somehow tell it which machine to send to (via the WCF service interface). It's this bit I am most confused about how to do.

Upvotes: 3

Views: 978

Answers (3)

NateTheGreat
NateTheGreat

Reputation: 2305

I have done this exact thing. What you've described is correct (although keeping nodes in sync and not allowing them to step on each other can be rough in a distributed environment). For locating the endpoints, I'd recommend using WS-Discovery as described at http://msdn.microsoft.com/en-us/library/ee354381.aspx. If you're not using .NET4, you can still implement discovery yourself using a service or endpoint behavior.

Upvotes: 4

John Saunders
John Saunders

Reputation: 161783

Like any other WCF service, your services will expose endpoints. The client will simply send to those endpoints, just like normal.

Perhaps you're unfamiliar with the overloads of the proxy constructor? There are some which accept an endpoint address, permitting the client to choose which service endpoint to use.

Upvotes: 2

George Polevoy
George Polevoy

Reputation: 7681

You are talking about an NLB solution.

Upvotes: 1

Related Questions