Chrome on Windows 11 refuses to connect to Localhost.

The localhost failed to connect problem simply indicates that you are unable to access the web server using localhost

 This guide is meant to assist website owners and administrators in finding the best fixes if you receive the Localhost refused to connect error message while operating any web server on your personal Windows 11/10 computer.


What does a localhost connection refusal mean?

The localhost failed to connect problem simply indicates that you are unable to access the web server using localhost. Your firewall can be preventing the connection, it's possible. By changing your firewall settings to let incoming connections for the port that MAMP is attempting to reach, you may frequently fix this issue.

The following are the most likely causes of this error:

  • Localhost does not map to 127.0.0.1.
  • Running a web server on Windows with WSL.
  • Another programme on your PC uses port 80.
  • Using the wrong port to access your web server.
  • Not enough permissions.
Try the unranked suggestions listed below if the Localhost refused to connect error message displays on your Chrome browser while using a Windows 11/10 PC to see if that resolves the problem.
  • Use 127.0.0.1 to access Localhost.
  • Utilize Port Number to Connect to Localhost.
  • In XAMPP, change the Apache port.
  • WAMP: Change the Apache port.
  • Delete the file application.config (if applicable).
  • Start the LxssManager Service again (applies to Web Servers running on WSL).
Let's look at the explanation of the steps that each of the solutions given need.

1. Use 127.0.0.1 to access Localhost

For this approach, you must launch XAMPP or WAMP to start the web server, then open your browser, type 127.0.0.1, and press Enter. If this solution resolves the Localhost Refused to Connect problem notice, it implies that localhost isn't pointing to this IP, therefore you'll need to enter 127.0.0.1/filename rather than localhost/filename to access any projects or files on your web server.

2. Utilize Port Number to Connect to Localhost

You will see this error if your web server isn't running on port 80 by default. You can visit the local web server in this situation by giving the port number; to do so, type localhost:8080 into your browser.

3. In XAMPP, change the Apache port

Change the Apache operating port in XAMPP by doing the actions below:

  • From the Start Menu, launch XAMPP.
  • To open the XAMPP Control Panel, double-click the XAMPP icon on the taskbar's system tray.
  • You would see a list of services, such as Apache, MySQL, etc., that are currently active on the XAMPP Control Panel Window.
  • There would be a Stop button next to the service's name.
  • In front of the Apache service, click Stop.
  • Next, launch File Explorer by pressing Windows key + E.
  • Go to the directory listed below now:
C:\xampp\apache\conf
  • Search the location for a file with the name httpd.conf.
  • Open the file in a Text Editor next.
  • Look for the following two lines in the file: Listen 80 ServerName localhost:80
  • In their stead, use the following: Listen 8080 ServerName localhost:8080
  • The file can be saved by using CTRL + S.
  • Reopen the XAMPP Control Panel and launch the Apache webserver at this point.
If the error was brought on by a conflicting port number, it should be resolved right away. If not, try the next option.

4. Change the port for Apache in WAMP

Do the following to modify WAMP's Apache operating port:
C:\wamp\apache2\conf
  • Search the location for a file with the name httpd.conf.
  • Open the file in a Text Editor next.
  • Look for the following two lines in the file: Listen 80 ServerName localhost:80
  • Replace them with the followingListen 8080 ServerName localhost:8080
Open WAMP now to see if the problem has been fixed. Try the following option if the latter is true.

5. Delete the file application.config (if applicable)

Follow these steps to remove the application configuration file:
  • Launch File Explorer and choose the project folder.
  • The.vs folder should then be opened. You might need to make hidden files and folders visible.
  • Explore the config folder after entering the.vs folder.
  • Remove the application.config file from the config folder.
  • Shut down File Explorer.
Try the following solution if the problem is still not fixed.

6. Start the LxssManager Service again (applies to Web Servers running on WSL)


إرسال تعليق

© Load Info Hub. All rights reserved. Distributed by Pixabin Official