WCF call back in load balancing server

627 Views Asked by At

I have a chat application developed using WCF call back contract.This use netTcp binding for the client server communication.

Client is a Windows Forms application will be running in the client machine(XP or Windows8 machine)

This WCF service hosted as a windows service in the server machine.I am maintaining a Client Session list in the service, this will store the details about each client connected to the server, this list is static variable.

The work flow is, whenever a client connect to the server using the connect operation,client details will be added to the client session list,this session list will be used by the server to send message back to the client whenever its needed.

Everything works fine in the single server environment,Now I want to know how can I handle this in the load balancing scenario, that means I have two server machine,at a time one server will be active.if Server 1 is fail, Server 2 will be active. In this scenario, How can I manage my client sessions share between two servers and working as usual with out disturbing my clients?

1

There are 1 best solutions below

0
On

One option is to use a Session State store provider, which will provide the session state for both instances of server service.

As MSDN states: http://msdn.microsoft.com/en-us/library/z414bbk9(v=vs.100).aspx

for Web farm configurations, it can be stored out of process using either the ASP.NET State service or a Microsoft SQL Server database.

The ASP.NET state service is quite well documented http://msdn.microsoft.com/en-us/library/ms178581(v=vs.100).aspx

As for the database solution... well... you have to analyse the added overhead due to database access.

Also, if you are hosting the service using IIS, you could consider using Out-of-Process session state (http://technet.microsoft.com/en-us/library/cc754032%28v=ws.10%29.aspx).

These are just some ideas. You can look into other web farm synchronization techniques made available for Microsoft technologies.