13 Replies - 4642 Views - Last Post: 23 February 2011 - 05:38 PM Rate Topic: -----

#1 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Could not connect to local host

Posted 23 February 2011 - 02:42 PM

I've started learning ASP.NET (not going well at all) and when I try to debug, google chrome says it cannot connect to the local host.
Any ideas why this is happening?

Thanks for any help.
Is This A Good Question/Topic? 0
  • +

Replies To: Could not connect to local host

#2 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 03:12 PM

Hi @DivideByZero

Can you provide a little more details? Have you tried any other browsers and are still experiencing the same issue, or is it just the chrome browser that is returning this error?

Can you give us anymore details about the app you are running and how you are running it? For example, are you just clicking the debugger in VS to build and run your application and chrome is your default browser? Or are you copying and pasting the url to the local host directly from within your browser to run your application...?
Was This Post Helpful? 1
  • +
  • -

#3 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 03:14 PM

View PostkeakTheGEEK, on 23 February 2011 - 03:12 PM, said:

Hi @DivideByZero

Can you provide a little more details? Have you tried any other browsers and are still experiencing the same issue, or is it just the chrome browser that is returning this error?

Can you give us anymore details about the app you are running and how you are running it? For example, are you just clicking the debugger in VS to build and run your application and chrome is your default browser? Or are you copying and pasting the url to the local host directly from within your browser to run your application...?

Thanks for the reply :)

I'm unable to try it on other browsers as when I press f5 it automatically does it on Google chrome (yes, it's my default browser).

This post has been edited by DivideByZero: 23 February 2011 - 03:16 PM

Was This Post Helpful? 0
  • +
  • -

#4 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 03:21 PM

View PostDivideByZero, on 23 February 2011 - 03:14 PM, said:

I'm unable to try it on other browsers as when I press f5 it automatically does it on Google chrome.


This is because chrome is currently set as your default browser. Just for kicks open up Internet Explorer, then go to tools menu and select internet options. Then click on the programs tab and in that tab there should be a section labeled Default Browser. In that section click on the button [Make Default]. You can always change this back after you test. Try that and let's see if you still get the same error....


Also, what version of Windows are you running (assuming you are using windows)?
Was This Post Helpful? 1
  • +
  • -

#5 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 03:26 PM

View PostkeakTheGEEK, on 23 February 2011 - 03:21 PM, said:

View PostDivideByZero, on 23 February 2011 - 03:14 PM, said:

I'm unable to try it on other browsers as when I press f5 it automatically does it on Google chrome.


This is because chrome is currently set as your default browser. Just for kicks open up Internet Explorer, then go to tools menu and select internet options. Then click on the programs tab and in that tab there should be a section labeled Default Browser. In that section click on the button [Make Default]. You can always change this back after you test. Try that and let's see if you still get the same error....


Also, what version of Windows are you running (assuming you are using windows)?

I've made IE8 my default browser (I'm using vista btw) and it says it cannot open the page. So I click the diagnose problem button and it says this:

local host is not set up to establish a connection on port "55840" with this computer.

Any ideas what this means? I'm a complete web development noob (only doing this because a lot of .net jobs require asp.net).
Was This Post Helpful? 0
  • +
  • -

#6 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 04:02 PM

I personally have never experienced this while doing ASP .NET development on my personal machine, but there is a significant amount of documentation on the web (including Microsoft) on ways to resolve the symptoms that you are experiencing. It requires modifying the host file in the Windows directory on the root, so I am a little apprehensive about suggesting to jump right in and doing that. Here is a link regarding this issue on ASP .net website for reference.

Here are also a few others on the ASP .Net forum all with similar suggestions that seem to solve the problem.
http://forums.asp.net/t/1394856.aspx
http://forums.asp.ne...86.aspx#2994686

I recommend reading through those threads on MS's ASP .NEt website. From the other threads, it sounds like you will need to modify/comment out an entry in your host file...
Was This Post Helpful? 1
  • +
  • -

#7 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 04:12 PM

The sad thing is, I have no idea how to even approach the solutions given in those threads.
Like I said, I'm more of a software guy. Web apps confuse the hell out of me and seem way too overcomplicated than it needs to be.

Thank you for your help, it's a shame I can't fix this problem :(
Was This Post Helpful? 0
  • +
  • -

#8 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 04:58 PM

@DivideByZero,


Don't give up so easily. Let's try and work though this and see if we can fix the issue. We can troubleshoot together.

On your machine, go to this directory C:\WINDOWS\system32\drivers\etc and see if you have a file called hosts. If you do, open that with notepad and let me know what is entered in it.

Here is what's in mine:
# Copyright © 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

Was This Post Helpful? 1
  • +
  • -

#9 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:03 PM

View PostkeakTheGEEK, on 23 February 2011 - 04:58 PM, said:

@DivideByZero,


Don't give up so easily. Let's try and work though this and see if we can fix the issue. We can troubleshoot together.

On your machine, go to this directory C:\WINDOWS\system32\drivers\etc and see if you have a file called hosts. If you do, open that with notepad and let me know what is entered in it.

Here is what's in mine:
# Copyright © 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost


Found it eventually.

# Copyright © 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host


::1             localhost


As you can tell I'm using an old laptop because my work laptop's wifi is broke and currently getting repaired.

Thanks for the help, I really appreciate it :)

This post has been edited by DivideByZero: 23 February 2011 - 05:04 PM

Was This Post Helpful? 0
  • +
  • -

#10 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:08 PM

Change ::1 to 127.0.0.1 and save. After you do that, close ASP .NET Development Server. You can close it by right clicking on the icon on the bottom right of your task bar (next to the time) and selecting stop. Then try running your application again and see if you still get the error.
Was This Post Helpful? 1
  • +
  • -

#11 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:15 PM

It won't let me save the notepad file, it says "cannot create C:\\Windows etc"
Was This Post Helpful? 0
  • +
  • -

#12 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:26 PM

View PostDivideByZero, on 23 February 2011 - 05:15 PM, said:

It won't let me save the notepad file, it says "cannot create C:\\Windows etc"



I believe that this is because you are not modifying it as an admin role (even though you may be logged in as an admin, this can still happen)

Try it this way:

- Click Start, click All Programs, click Accessories, right-click Notepad, and then click Run as administrator.

- If you are prompted for an administrator password or for a confirmation, type the password, or click Allow or Yes.

- Open the Hosts file from the file menu within notepad, make the necessary changes, and then click Save on the Edit menu.
Was This Post Helpful? 1
  • +
  • -

#13 DivideByZero  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 240
  • View blog
  • Posts: 551
  • Joined: 02-December 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:32 PM

View PostkeakTheGEEK, on 23 February 2011 - 05:26 PM, said:

View PostDivideByZero, on 23 February 2011 - 05:15 PM, said:

It won't let me save the notepad file, it says "cannot create C:\\Windows etc"



I believe that this is because you are not modifying it as an admin role (even though you may be logged in as an admin, this can still happen)

Try it this way:

- Click Start, click All Programs, click Accessories, right-click Notepad, and then click Run as administrator.

- If you are prompted for an administrator password or for a confirmation, type the password, or click Allow or Yes.

- Open the Hosts file from the file menu within notepad, make the necessary changes, and then click Save on the Edit menu.


That did the trick :D

It took a while to load the page up, but it finally did it!

Thank you so much for your help :)
Was This Post Helpful? 0
  • +
  • -

#14 keakTheGEEK  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 108
  • View blog
  • Posts: 344
  • Joined: 23-February 10

Re: Could not connect to local host

Posted 23 February 2011 - 05:38 PM

View PostDivideByZero, on 23 February 2011 - 05:32 PM, said:

That did the trick :D

It took a while to load the page up, but it finally did it!

Thank you so much for your help :)


My pleasure. I am glad that solved the issue. Now you can enjoy developing great web applications on Microsoft's wonderful ASP.NET platform using the .NET Framework.

Have fun and don't hesitate to post in this forum if you need to :)
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1