4

I have a ASP.NET self-host web api, and I want it to listen on say http://77.176.132.62:51000.

Things work just fine with http://127.0.0.1:51000, but as soon as I change it to the server's valid IP address and port, I get this exception:

The format of the specified network name is invalid

In this answer, it's suggested that I change applicationhost.config file, but that's for IIS or IIS express. I fail to see how can I solve this problem using configuration file.

How should I solve this exception?

Community
  • 1
  • 1
Nasseh
  • 429
  • 1
  • 4
  • 12

2 Answers2

3

don't specify the IP, use * instead: http://*:51000

user1071420
  • 93
  • 3
  • 11
  • This should be marked as the correct answer. My problem was that I was setting a wrong IP (my machine had another IP assigned) so setting * made the error go away and now I don't have to think anymore about setting my development IP on the config. – Juanu Sep 11 '18 at 17:53
0

I have noticed this usually happens when the IP address of device is not same as the IP address which web api is trying to run on. Make sure both IP addresses are same and try again.

Tarun Kumar
  • 729
  • 1
  • 8
  • 16