c# - Re-writing the Hosts file does not update the next IP connection -


we have written c# application communicates 1 of group of ip in cloud. 1 of may not working. use url of address iis server expecting host header name in order route correct application interface.

so set hosts file point url @ ip. send command @ url server time.
tells connection working.

if don't response assume connection dead. write new ip list hosts file , try again.

this hit bug. application doesn't seem see hosts file has changed , uses old (bad) ip.

there no caching built application assuming windows caching us.

we've tried flush caches with:

ipconfig /flushdns arp -d * nbtstat -r

we still same problem. thoughts on how clear cache?

if can't address @ server end (e.g. load balancer, etc), use ip address list in code:

var req = httpwebrequest.create("http://" + ipadd.tostring() + "/path_to_query_time"); ((httpwebrequest)req).host = "yourhostheaderhere"; var resp = req.getresponse(); //if things have gone wrong here, change ipadd next ip address , start over. 

don't go messing users settings try , solve problem in application that's of own making.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -