4

I'm testing an ASP.NET application and by default the URL of my project in debug mode is of course something like:

http://localhost:61660/

Now, coming from the world of Linux and putting together what I know from my Networking classes in the past, I know that instead of using localhost you are also allowed to use 127.0.0.1 or your LAN IPv4 address which could be something like 10.75.88.252 that you can get from using the ipconfig command.

But all of these super basic and fundamental aspects of networking break down as soon as you enter a Microsoft network where Windows seems to take these rules and add a layer on top to further complicate Computer Networks which are already complicated enough with the additions of network WORKGROUPS and "Computer Names" which seems to behave like some kind of Intranet DNS.

So my main question is, how come this URL works perfectly in Visual Studio when debugging an ASP.NET app:

http://localhost:61660/

But these two below:

http://127.0.0.1:61660/

http://10.75.88.252:61660/

They do not work at all, even though localhost is the same as 127.0.0.1...

So does anyone know what could be the cause of this? When building web apps on a Windows Server, are there extra things that need to be configured like the firewall?

Setsu
  • 1,188
  • 13
  • 26
Mateusz266
  • 771
  • 9
  • 13
  • 8
    It mostly likely has nothing to do with Windows Networking. IIS (and IIS Express) can both be configured to respond only to certain host names. In your case, it looks like IIS will only handle requests to `localhost`. – Justin Niessner Apr 08 '15 at 19:06
  • You could use IIS as the web server instead of the web server that comes with Visual Studio. To guess at an answer to your question, I would suggest that maybe it is using host headers. – Andrew Morton Apr 08 '15 at 19:07
  • 1
    Ever heard of `/etc/hostname` on Linux? Yes, that's the *"computer name*" ;-) – Lucas Trzesniewski Apr 08 '15 at 19:07
  • you will need to really look at how IIS is configured also `:61660` is a port number not an ip address.. – MethodMan Apr 08 '15 at 19:07
  • Actually, they do work, you should get a 400 - Bad Request Error, which is an HTTP response. If it wasnt working, you would get a default message from your browser along the lines of 'Unable to Connect' – Mark Apr 08 '15 at 19:22
  • Why all the down votes, its a reasonable question. Yes, the OP is hating on Microsoft in a .NET post, but I don't think that is reason to down vote. Has nothing to do with the quality of the question. – Mark Apr 08 '15 at 19:36
  • 2
    @Mark, his own prejudices are preventing him from taking even the most basic steps of attempting to search for and find solutions to very common issues faced by Visual Studio / ASP.NET beginners. There's no evidence he's attempted to resolve these issues himself. This and his other questions establish a trollish tone. – overslacked Apr 08 '15 at 19:40
  • @overslacked, fair enough... – Mark Apr 08 '15 at 19:46
  • I totaly disagree with Oveslacked comment. I find the question legitimate and I would expect a more collaborative attitude rather than calling a trollish tone. Btw, other than moralistic or out-of-subject comments I did not find any attermpt to answer the question. – Jean-François Mar 24 '19 at 21:31

1 Answers1

7

I think maybe this will help you:

If you have hosted your application using IIS, you can bind your site using your local computer IP address to work it in LAN connection.

For adding website through IIS you can see go through the below links

http://www.iis.net/learn/manage/creating-websites/scenario-build-a-static-website-on-iis

http://blog.pluralsight.com/windows-server-2008-iis7

Binding IIS Express to an IP Address

Basically,you can edit the applicationhost.config file manually to bind to something other than localhost. Read the above links, but for example see below:

   <binding protocol="http" bindingInformation="*:8081:localhost" /> 
   <binding protocol="http" bindingInformation="*:8083:192.168.2.102" />
Community
  • 1
  • 1
Mark
  • 4,773
  • 8
  • 53
  • 91