0

TargetInvocationException getting thrown at the owincommunicationlistener class when multiple instances are created on the service fabric cluster, if i set the instance count to 1 , everything is fine. but when i increase it, the Exception gets thrown at the point where the web server starts.

Inner exception shows "Failed to listen on prefix 'htto://+:8961' because it conflicts with an existing registration on the machine"

  • Are you using the local dev cluster? If so, you can't open multiple listeners on the exact same url on one machine. – LoekD Nov 23 '16 at 08:09
  • Yes, im using the local dev cluster. Is there a way to get around this? – Madushan Fernando Nov 23 '16 at 08:17
  • Yes, start one instance on the dev cluster, or add some uniqueness to the URL, like a new guid. On a production cluster, you can use -1 as instance count to run on every node (in that case a node is a machine) – LoekD Nov 23 '16 at 08:42
  • What if i disable the capability to create more than one listener ? for example, i run the code inside a if condition which is based on a outside variable ? – Madushan Fernando Nov 23 '16 at 10:03
  • Why is running one instance for development purposes not good enough? The result would be the similar to running one instance, the rest would be 'zombies'. But with the downside that If the working instance encounters a problem, you'd need to deal with that yourself. (Like to reset the condition and restart the race to get the lease.) And what if the service that holds the outside condition has a problem? – LoekD Nov 23 '16 at 10:13
  • We are working on a proof of concept, and we need to show that its possible if necessary... – Madushan Fernando Nov 23 '16 at 10:20

1 Answers1

1

On Windows, Service Fabric leverage http.sys capabilities for HTTP listeners, make sure you follow the rules of http.sys. When running multiple instances (from different nodes) on the same machine, you need to have unique HTTP URL to prevent conflicts. As a guideline, the following link explains how http.sys works: https://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/a2a45c42-38bc-464c-a097-d7a202092a54.mspx?mfr=true

Same mechanism is used by IIS, but you don't need IIS to leverage Http.sys.

Consider working in single node mode locally to work around the issue.

Simon Luckenuik
  • 345
  • 4
  • 12