I have an application which consumes a WCF service via a Service Reference. We're doing some failure testing and we'd like to be able to model the service itself failing, but in this case can't stop the service. What's more, this needs to happen while the application is running and return to functionality after connectivity is restored.
I've tried using firewall rules for this, but for some reason if it connects fine initially then it will continue to connect fine afterwards. I assume this is because it makes a single initial connection then keeps it alive afterwards.
I thought maybe that I could change the hosts file, but I have run into the same issue. It connects just fine, I change hosts (and confirm that it redirects things like ping), but the app continues to connect just fine.
I've tried a number of things, such as ipconfig/flushdns. Is there anything else I can do? I considered creating a script to temporarily disrupt the outbound connections and force a reconnect. The problem is that if I'm RDPing into the machine, this will likely break my own connection! Which is undesirable.
Is there a way to either make the service client respect changes to the Hosts file, make it respect changes to the firewall, or easily and temporarily disrupt outbound connections without disrupting RDP?
EDIT: As a note, the connection utilizes Keep Alive
and this is something that we cannot change. Further, we are not using app.config
, so we also cannot change that. Lastly, we cannot install any additional software on the machine it turns out. Everything must be internal to the OS to do this.