Benjin
Benjin

Reputation: 2409

Service working on localhost but not 127.0.0.1?

I'm trying to test a webservice, but when I run it in Visual Studio, it's only accessible at (for example) localhost:9000/api/Maps/1. I need it to also be exposed through 127.0.0.1:9000/api/Maps/1 (for testing with an emulator), which currently only gives a 400 error ("Bad request - invalid hostname").

I thought localhost and 127.0.0.1 were meant to act identically. What's going on here, and how can I resolve it?

Upvotes: 1

Views: 820

Answers (1)

Pablo Romeo
Pablo Romeo

Reputation: 11396

I'm assuming you're talking about a WCF service. Have you checked the BaseAddress setting in your configuration file?

<baseAddresses>
  <add baseAddress="http://127.0.0.1:9000/service" />
</baseaddresses>

Upvotes: 1

Related Questions