To start the weblog.asp.net blog I was thinking to post the Load Balancer code I wrote in back in 2005. I'll be using this blog to post code for now that may help somebody.
What does it do?
When you have more than one copy of the website and no load balancer to balance traffic, this little concept may help you. Will make sure to send the user round robin to each computer. Using this kind of http Load Balancer is not bullet proof as using Windows 2003 Server balancer or a Cisco load balancer for a production enviorement.
How to use it
There is not sticky ip at this moment, will check the computer before sending the user, if the server does not reply with an HTTP 200, will be redirected to the next one. If all servers are down, will reply with a message "All Servers down".
// Add the dll into your project and add using LoadBalancer
LoadBalancerRun oLoad = new LoadBalancerRun(System.Web.HttpContext.Current); oLoad.Run("d:\\Projects\\ProjectName\\LoadBalancing.xml");
// Format of LoadBalancing.xml
The file is a test file only will load balance between codeproject web servers.
You may want to change that :-)
Download here
Summary
The code is just a proof of concept, I would recommend to use a Http Handler if you thinking in use it for more production code.
Cheers
Al