Djinn
Djinn

Reputation: 326

Why is my local website not working in IIS

This problem has a very simple (almost silly) fix, but it took me 2 hours to discover today, and none of my searches gave the answer, so I am posting this along with the answer to help others.

I have a website set up in IIS to run locally, which has worked in the past.
The URL is like: http://localhost/mywebsite

But today when I tried to open the site, it did not work in any of my browsers (IE, Chrome, and Firefox). Even the main IIS Welcome page at http://localhost was not working.

Neither restarting the server in IIS, nor calling iisreset from a command prompt fixed it.

I compared my "hosts" file to another computer which was not having the problem. Both had the same entry for "127.0.0.1 localhost".

I checked the Services panel and verified that "World Wide Web Publishing Services" was running.

I ran "netstat -a". It showed nothing listening on port 80, but I didn't know what was causing that.

Based on suggestions I found while searching for a solution, I tried the following, none of which fixed the problem:

I still had the same problem.

What else could be causing IIS and my local website not to work?

Upvotes: 7

Views: 79081

Answers (6)

khallaf mohamed
khallaf mohamed

Reputation: 1

Sometimes this problem happens because the application pool is stopped after the server machine was restarted. This is the problem that happened to me. If the application pool is stopped, try restarting it. Picture for clarification:

enter image description here

Upvotes: 0

Adding new https binding in IIS helped me as well. Then I discovered that my original https binding did not have any SSL certificate selected. Once I selected one my local application started to work again with the default port 443.

Upvotes: 0

Roman
Roman

Reputation: 1

Here is my solution of similar problem with localhost not working in local browser:

  1. Go to IIS panel and right-click mouse on your site
  2. Choose "change bindings"
  3. Make sure IP is "All unassigned" and Host name is not defined (empty)

Upvotes: 0

Megan Walley
Megan Walley

Reputation: 1

I encountered this issue recently, and none of the other answers here helped me. I was unable to connect with http://localhost/mywebsite, but I could with http://127.0.0.1/mywebsite. I was able to put a bandaid on the issue by creating a new binding:

Type: https
IP address: All Unassigned
Port: 443
Host name: empty
[x] Disable Legacy TLS
SSL certificate: IIS Express Development Certificate

I could then connect with https://localhost/mywebsite. Hopefully this helps someone else!

Upvotes: 0

wernhervb
wernhervb

Reputation: 43

I had also this situation where a local website hosted by IIS did not work. My site was already started but it seemed to lack the rights for an internet browser to access to the local site.

In my case I got the site working by giving the site's root folder (and its contents in the Windows 10 file system) the following usage rights:

Authenticated Users

This usage right can be set in folder properties and its security tab.

Other usage rights present are:
SYSTEM
My own account
Adminstrators (MACHINENAME\Admistrators)

I post this solution here in case someone is in trouble with the same issue.

An update: This 'Authenticated Users' group needs also permission to modify files and folders in case e.g. Wordpress is used as a local site and the adminstrator wants to e.g. update themes and plugins of the site.

If this permission is not set, Wordpress will fail to write the updates to the local folder. The message shown is: "Installation Failed: Could Not Create Directory".

However, please note that at the moment I cannot guarantee that these settings are completely safe and do not compromise your system for attackers etc. But I've taken the risk myself, and the settings will provide a working environment to develop locally.

Upvotes: 0

Djinn
Djinn

Reputation: 326

Make sure the website has been started in IIS:

  • In the left pane of IIS Manager under "Sites", select the appropriate site. If your site is configured under the "Default Web Site", select that one.

  • In the right pane under "Manage Website", there are "Start" and "Stop" links.

  • When the website is running, the Start icon (arrow) will be gray and its link will be disabled; the Stop icon (square) will be black and its link will be enabled.

  • When the website is NOT running, the Start arrow will be green and enabled; the Stop icon will be gray and disabled.

So if the Start link has a Green arrow by it, that means the website is NOT running, and you need to click to start it.

By default, web sites are started automatically when IIS is started or restarted. But if you click the link to stop the site, it will remain stopped even after you reboot the computer or restart IIS. It won't be restarted until you click Start again.

Upvotes: 0

Related Questions