37

I am doing a web project using visual studio 2010(MVC3 Razor) and Windows 7.

My default browser is IE. When I run the project, the website working is perfectly with the url

http://localhost:49824/

When I copy the same url and try to run the website in Chrome or Firefox it shows me the following error.

ERROR

The requested URL could not be retrieved    
The following error was encountered while trying to retrieve the URL: http://localhost:49824/    
Connection to 127.0.0.1 failed.    
The system returned: (111) Connection refused    
The remote host or network may be down. Please try the request again.    
Your cache administrator is webmaster.

I have rebuilt the solution and added the url to allowed site. But still the problem persists. How should I solve this problem?

13 Answers 13

75

Finally I found the solution ... It's very easy

  1. Go to the LAN settings (In Chrome : Tools -> Options -> Under the hood -> Change Proxy setting -> LAN Setting)

  2. There will be a checkbox for "Bypass proxy server for local address"

  3. Tick the checkbox.

Done!

On Mac/Apple: Chrome uses system preferences for localhost exclusion:

  1. Go to System Preferences -> Network -> advanced -> Proxy settings

  2. Add 'localhost' at the bottom where it says: 'ignore proxy settings for these hosts and domains' (Exceptions are separated by a comma)

5
  • 1
    where is the firefox solution? Nov 9, 2012 at 15:06
  • about:config > set "browser.urlbar.trimURLs" to false worked for me.
    – Tom
    Aug 26, 2013 at 19:46
  • 3
    IN FF, under advanced, network, settings, change proxy to manual (you'll have to know what your proxy details are), and then add 127.0.0.1 to the "no proxy for" list. Dec 10, 2014 at 11:16
  • Worked for me as well!! Thanks a lot!! Feb 2, 2017 at 14:20
  • This guide is heavily out of date and is not reflective of the current situation anymore with Chrome.
    – Code Doggo
    May 25, 2021 at 1:14
17

For all browsers,

  • Open internet Options (or Internet properties)
  • Go to connections tab
  • Click on LAN Settings
  • Tick Use proxy server for your LAN
  • Tick Bypass proxy server for your local address (Don't change the port number)
  • Click on Ok

Now you are good to go. :)

2
  • Proxy settings are no longer controled in Chrome it seems like. I can't find this option anymore and searching for "Proxy" in the chrome settings just opens up the Windows proxy settings from Settings app.
    – Code Doggo
    May 25, 2021 at 1:14
  • Perfect solution! Jun 20 at 11:11
9

I faced the same issue and the complete solution is to set to false(uncheck) the "Automatically detect settings" checkbox from Lan Area Network( the same window as for Bypass proxy server for local address )

0
9

If you are using windows system:

please check the file

C:\Windows\System32\drivers\etc\hosts

and add line such as:

127.0.0.1 localhost

1
  • While this should work, it seems like it is masking over a larger issue Mar 2, 2015 at 21:34
6

For Chrome go to

Settings->Network->Change Proxy setting

Now Internet properties will open so you need to go LAN settings and click on check box :

Bypass proxy server for local address

2
  • Chrome uses your local internet settings. So go to Internet Options > Connections > Lan Settings - and click Bypass Proxy Server. Jan 13, 2017 at 16:45
  • this is worked for me. wrong proxy settings affected my postman requests too.
    – Arif Acar
    May 29, 2017 at 5:52
1

Changing my LAN network settings to not automatically detect a proxy server worked for me BUT resetting your Windows network stack may help.

See The Nuclear Option: Resetting The Crap Out Of Your Network Adapters in Vista from Scott Hanselman.

1
  • Windows 10 - VS 2013, same issues, this is the only thing that worked. Jun 20, 2016 at 11:58
1

In case the browser LAN proxy setting solution doesn't work for you:

As mentioned in this similar Q&A How to solve ERR_CONNECTION_REFUSED when trying to connect to localhost running IISExpress - Error 502 (Cannot debug from Visual Studio)?

Simply changing the port number of your web project can be a quick fix.

enter image description here

0

For Firefox:

  1. Go to LAN Settings: Options->Advanced->Network. In the "Connection" section of the "Network" tab press "Settings" button to open "Connection Settings" dialog box.
  2. Select "Manual proxy configuration:" radio button
  3. The "No proxy for:" textbox should contain the following text: "localhost, 127.0.0.1"
0

For my project, I am set up to use https. I just got a new computer and cloned the project in git. The protocol and port number for the project are not saved in the solution file, so you have to make sure to set it again.

enter image description here

0

I found that when I had this issue that I had to delete the application.config file from my solution. I was pulling the code from co-worker's repository whose config file was mapping to their local computer resources (and not my own). In addition to that, I had to create a new virtual directory as explained in the previous answers.

0

You need to disable Script Debugging In Visual Studio

0

None of the solutions mentioned above worked for me. So if you have changed port number in httpd.conf and httpd-ssl.conf, you need to change port in xampp config, too.

You can do that by:

  • Go to xampp control panel,
  • go to service and ports settings,
  • change the port number as you have done in config files,
  • and save.
-1

Steps

  1. Search IIS In Visual Studio 2015 Search IIS image

  2. Chose (Use the 64 bit of version of IIS Express for web site and project Use 64 bit image )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.