0

Dinamically switching response ip address(c#)

I am trying to make a small script in ASP.NET(C#) that interface with external RESTapi service,
the problem is that i want the script to switch response ip address after 10(for example) requests,
i bought 12 static IP addresses to my server and binded all of them to the network card and to the iis application.
i searched all over the internet and didnt found even a small example of how to do this, is it possible at all?
the script should look like this(only for example):

string[] ips = {"1.1.1.1","2.2.2.2","3.3.3.3",....}; int i = 0,sel=0; foreach(var request in requests) {	if(i % 10 == 0) sel ++;	if(sel == ips.length) sel = 0;	doREST(request,ips[sel]);	i++; }

Another idea

i Thought about another idea, maybe its better to do a request to my server himself, for example from:

example.com/edit/post/12

to:

1.1.1.1/do-rest/12

and than to:

2.2.2.2/do-rest/12

the problem with this is that it could be high amount of request inside the server on high traffic.


Thanks!

1
  • Windows Server 2008 R2 + will have load balancing feature by default. To how to use it, You can read it here Commented Nov 17, 2015 at 8:51

1 Answer 1

2

Truly, the way you are thinking it can't be the right way of balancing the load. You need a load balancing software.

Load balancing software is a networking solution responsible for distributing incoming traffic among multiple servers hosting the same application. It balances application requests across multiple servers.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.