1

I am trying to bind a self host web api on all network interface. The common usage si provided in this other question: Web API self host - bind on all network interfaces . However the asterisk is not accepted in the base adress. The following code:

string baseAddress = string.Format("http://*:9000/"); 
config = new HttpSelfHostConfiguration(baseAddress)

will throw a "System.UriFormatException"

According to here "*" is forbidden in Uri but then I am wondering if there would be an other way to define such a base address?

  • Did you try `http://+:9000/` – Gerben May 23 '17 at 14:46
  • @Gerben I also get a System.UriFormatException. You are right, this one should have worked if the problem was the asterisk. I think I don't understand what happens there. – Robert Berte May 23 '17 at 14:53
  • What if you drop the last forward slash? `http://+:9000` – Gerben May 23 '17 at 14:55
  • @Gerben same problem. Basically I was working with http://localhost:8080 (everything was okay) and I replaced by a symbol afterward so I can tell for sure that the rest of the line is okay. I just realize that my code sample does not mention any asterisk btw. I have to correct that. – Robert Berte May 23 '17 at 14:58

0 Answers0