We help IT Professionals succeed at work.

Localhost access denied

kasims
kasims asked
on
4,285 Views
Last Modified: 2017-06-08
I had this question after viewing HTTP Error 403 - Forbidden: Access is denied When I try to reach http://localhost.

I set up an ftp server to dish up archived sermons and it works flawlessly from a computer web browser via download or streaming(mp3 format). However, I discovered today that no matter what flavor of smart phone(android or apple), the stream fails. I expected to prompted to download the file via phone, but, they attempt to initiate a stream instead with no option for downloading. I ended up giving up and decided to attempt an iis website to serve them up. After setting it up along with permissions for IIS_IUSR but am still getting 403 error of forbidden. I've done an iisreset a couple times to no avail.
 I haven't been able to view even the default website from http://localhost or http://servername to check on my directory browsing. Not sure where else to look.
Obviously, I don't have an extensive background with iis, and any help would be appreciated.

Thank you
Comment
Watch Question

Jason clarkDBA Freelancer

Commented:
Not sure but you may try to create a new site in IIS. And use it:

https://www.experts-exchange.com/questions/21004310/HTTP-Error-403-Forbidden-Access-is-denied-When-I-try-to-reach-http-localhost.html
You may have a look.
hope this might work for......
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
What version of Windows OS are you using?

1. What Application Pool are you using?  The DefaultAppPool or one you created?
1a. If you created an AppPool, have you left it with the default settings?
2. Have you set up a site or are you using the default site?
3. Are you a static HTML site or a coded one (with PHP, ASP.NET, etc...)
4. Do you have HTTP logging enabled with all fields?
4a. If so, can you post a section of the logs from during a session where you get the 403
4b. If not, I recommend installing and enabling the feature, then make several attempts at accessing the page, then post logs.

Dan

Author

Commented:
Thanks guys for the help. Here's the lowdown on the config: I've been messing around with it and got the 503 to go away, but, the incorrect site shows that actually looks like an ftp site. I've attached a couple of screenshots and some logging entries.
Server 2008r2
1.I created a new application pool and after it failed, I changed it to DefaultAppPool but default threw a 503 error.
So I stopped the default and switched back to my new app pool. So now I actually get 4 files to display ( aspnet_client, iisstart.htm, web.config, welcome.png), but, no directories.
1a. Yes, default settings.
2. No new site, but, don't see a default site either.
3. Not sure how to answer, as I don't see a site at all.
4. I have enabled logging.
Thank you for all the help.
u_ex170425--1-.docx
u_ex170425--1-.txt
u_ex170425--2-.txt
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
1.  The http logs are indicating that IIS cannot find the content you are trying to request.  That is what an http error code of 404 means.  Below is a clip from your http logs, as an example:


2017-04-24 22:50:12 ::1 GET /grace - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 404 0 2 359
2017-04-24 22:50:27 ::1 GET /gracechurofloris - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 404 0 2 0
2017-04-24 22:50:42 ::1 GET /gracechurhofloris - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 404 0 2 0
2017-04-24 22:50:53 ::1 GET /gracechurchofloris - 80 - ::1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+Trident/7.0;+rv:11.0)+like+Gecko 404 0 2 15


Plus, from the https logs above, you can see the following:
a. you appear to requesting a directory not a file.
b. your website is answering on the localhost address for IPv6.  "::1" is the v6 variant of "127.0.0.1"... aka: localhost.

2. So where (in what directory/folder) are these files you are trying to serve up?
- The root of the website shows only the default website content that is setup with the installation of IIS.

3.  You have the bindings on the site set to "*" otherwise labeled "All unassigned" which means that IIS can respond on any IP address (v4 or v6) that it finds on the server.
- I recommend that you chose an IP address (preferably an IPv4) for IIS to use with the http protocol.

Dan

Author

Commented:
I have enabled directory browsing on that site, but, I don't see a way to accomplish it.
2. There are multiple directories that contain messages off of the root of our E: drive. That is why I've tried to open by directory to see if it will allow. A test connection to the physical  path is successful. The virtual directory is contained in the physical directory as well. IIS doesn't see the new website at all, yet I see the web.config located in the directory.
3. I changed the binding to include the physical address and lost contact with the website entirely. When I changed it back, I was able to access again.
Thank you for the help, I apologize for my lack of IIS prowess.
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
Additional question:  what domain will your site be accessible at?

The default website looks for content at this location:  C:\inetpub\wwwroot.  Which is where you will find the "iisstart.htm" and "web.config" files you see when browsing to localhost.

In order to get the files on your E Drive visible on the website, you need to do one of the following 2 things:

1.  Create virtual directories that point to the content on your E Drive.
2.  Copy the content from its current location (E:\) to C:\inetpub\wwwroot

Either way accomplishes the same thing.

But I am not a fan of using the default directory for IIS.  I recommend the following:

1. In the directory/folder "C:\inetpub\wwwroot" create a new directory called:  MyWebSite
2. In IIS Manager, reconfigure the site that currently exists to use this directory as its physical source.

For example, I use the following structures when I setup a site:

1. Create new wwwroot directory.  For example:  C:\WebApps
2. Create directories under C:\WebApps for each site hosted on the server.
2a. For exampe:  C:\WebApps\www.website01.com, C:\WebApps\www.website02.net, C:\WebApps\www.website03.org
3. Place all content (folders and files) under the respective directory
4. Create a site in IIS, name it according to its URL.
4a. For example:  www.website01.com, www.website02.net, www.website03.org
5. Use the corresponding folder from step 2/2a for the site as the physical directory of the site

In general, you will now have a site structure that is easy to ID and manage.

Dan

Author

Commented:
Thank you for the help. I've been tied up and hope to address this over the weekend.

Author

Commented:
So I guess I need to delete the existing virtual directory I created previously and recreate it. Just not sure how to make it show up next time or why it doesn't show now.
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
If you also ready have virtual directories for the HTTP Site setup, just update the "Physical path" setting and hit OK.

Virtual directories setup in an FTP Site, have nothing to do with the web site.  The web site cannot see the FTP site settings.  You would have to create those vDirs under the site.

Dan

Author

Commented:
Ok, I set the site up, entered the physical path and performed a test successfully, but, localhost connection returns 404.
I removed the virtual directory thinking that could be the problem, but it provided no change in functionality. I'm basically no further along than I was 3 weeks ago.
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
Can you post the bindings for the site?  In a console with "Run as Admin" ... do the following please:

1.  go into the directory c:\windows\system32\inetsrv
2.  type the following command:

appcmd list site

Open in new window


3. post the result

Dan

Author

Commented:
Thank you Dan. Here you go.

C:\Windows\System32\inetsrv>appcmd list site
SITE "Default Web Site" (id:1,bindings:http/*:80:,net.tcp/808:*,net.pipe/*,net.msmq/localhost,msmq.formatname/localhost,state:Started)
SITE "GraceFTP" (id:2,bindings:ftp/*:21:,state:Unknown)
SITE "Grace" (id:3,bindings:http/*:80:gracechurchofloris.ddns.net,state:Started)
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
- Is anything running in or under teh "Default Web Site"?

In a console with "Run as Admin" ... do the following please:

1.  go into the directory c:\windows\system32\inetsrv
2.  type the following command:

appcmd list vdir

Open in new window


3. post the result

What this will do is display the virtual direcorties and virtual applications associated with web sites.  It will give me an idea of how you have set things up.

Dan

Author

Commented:
I have nothing running under the default web site.

Here are the results of the above command:
C:\Windows\System32\inetsrv>appcmd list vdir
VDIR "Default Web Site/" (physicalPath:%SystemDrive%\inetpub\wwwroot)
VDIR "GraceFTP/" (physicalPath:D:\GRACE TEACHINGS)
VDIR "Grace/" (physicalPath:D:\GRACE TEACHINGS)
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
When you browse to http://localhost/ what do you see?  The Microsoft IIS8 page?  Blue with an image in the middle?

So, in order for you to see any content, you need to create virtual directories that point to the site content that exists on the E: drive.  This is the source of the HTTP Error 404s, content not found.

Also, what types of files are in those directories?  What extensions do the files have?

Dan

Author

Commented:
The following is actually the vdir and pointing to the mp3 archives.
VDIR "Grace/" (physicalPath:D:\GRACE TEACHINGS)

Author

Commented:
Also when I browse to http://localhost I receive the following:

Snippet of localhost
Its obviously pointing to wwwroot, which isn't in use.

I appreciate all the help you've given me. There has to be something simple that I'm missing.
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
When you browse to localhost, given the way your IIS Server is setup, IIS will deliver the content of the first site it matches to localhost.  SInce every site is using the * binding, you are getting the content of site ID1, the default site.

Also, you have a site setup, called grace, which is indicated by the appcmd list site command.

SITE "Grace" (id:3,bindings:http/*:80:gracechurchofloris.ddns.net,state:Started)

1.  Where is that site pointing its content directory to (physical path)?
2.  You have a Host Name configured on the IP Binding, so you must use "gracechurchofloris.ddns.net" to access it.

So, what happens when you type in the following URL?

http://localhost/grace

Open in new window


Do you see a directory listing of your mp3 files?

If nothing is running under the default web site, just delete and it will make your setup much easier to manage.

Dan

Author

Commented:
Sorry for the delay on this matter.
I've been using the ftp server as a stop gap.
I'll look at this further today.
BTW, when I use http://localhost/grace, I receive a 404 error.
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
@kasims:  As I mentioned above, you cannot use localhost to access the site because you have added a Host Name to the site's binding.  This is why you are getting 404s when using localhost/grace.  You need to your the URL of the site... the same config item that is entered in the Host Name field.

Dan

Author

Commented:
I deleted the default website as a first step. Now the gracechurchofloris.ddns.net gives a 503.
An iisreset doesn't resolve it.
I removed the site name from the binding, performed an iisreset and still get 503.
I added the site name to the host file as dns couldn't resolve it internally, then performed an iisreset. Still no dice.
Doesn't respond to localhost (503) or localhost/grace (503). Restarted the website to no avail.
sheesh.......
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
Any 500-599 HTTP error is a server error, not something a reset will resolve.  a 503 error means the service/site is not available.

Please save the code below in a file and name it Get-IisInfo.ps1

Import-Module WebAdministation
gci IIS:\Sites | Select * > sites.txt
gci IIS:\AppPools | Select * > app-pools.txt

Open in new window


Can you post the output of the following commands?

- from a PowerShell Command Prompt using "Run as Administrator:
** before running the commands, navigate to your "My Documents" directory

appcmd list apppools
appcmd list sites
Get-WindowsFeature web* > IisFeatures.txt
Get-IisInfo.ps1

Open in new window


- The appcmd commands will output to the console.
- The "Get-WindowsFeature" command will create a text file called IisFeatures.txt
- The PowerShell script will create 2 text documents:  app-pools.txt & sites.txt

Can you post/upload these?

From this info, I should be able to make some recommendations.

Dan

Author

Commented:
Sorry Dan, but I cannot get appcmd to run(not recognized: exactly why I despise PS).
I tried the following instructions to get it to run:
SET PATH=%PATH%;%systemroot%\system32\inetsrv\
Set-Location %systemroot%\system32\inetsrv\
neither one could find the path on 2008r2 with default config.
Get-WindowsFeature is also not recognized.

Is it possible to run these commands from a GUI?
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
What Windows OS are you using?

PowerShell is nothing more than a DOS console on steroids.  No fear...

1. Go to your My Documents directory.
2. Create a text file and rename it to Get-IisInfo.ps1
3. Open a DOS console (with Run as Admin)
4.  Run the following commands:

- C:\Windows\System32\inetsrv>appcmd list apppools
- C:\Windows\System32\inetsrv>appcmd list sites
** this should output to the console, please post
** ** you were able to run these command previously

5. While still in the DOS console, run:  powershell
*** you should now have a PS prompt
6.  Make sure you are in the My Docs direcotry where you saved the ps1 from step 2
7.  Type this exactly:   .\get-iisinfo.ps1
8.  Hit enter, the script will save 2 files in the My Docs dir.
9.  Please post the files.

For get the WindowsFeature command, probably wrong version of OS and PS.

Dan

Author

Commented:
I'm running 2008 r2

Here is the 'list apppools' output:
c:\Windows\System32\inetsrv>appcmd list apppools
APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Stopped)
APPPOOL "ASP.NET v4.0" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "ASP.NET v4.0 Classic" (MgdVersion:v4.0,MgdMode:Classic,state:Started)
APPPOOL "Grace" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)

Here is the 'list sites' output:
c:\Windows\System32\inetsrv>appcmd list sites
SITE "GraceFTP" (id:2,bindings:ftp/*:21:,state:Unknown)
SITE "Grace" (id:3,bindings:http/*:80:,state:Started)

app-pools.txt
sites.txt

Thank you
Dan McFaddenSystems Engineer
CERTIFIED EXPERT

Commented:
So, your 503 error (service not available) is due to the fact that your website "Grace" is using the "DefaultAppPool."  You can see from the appcmd output above, that the pool named "DefaultAppPool" is in the state of "Stopped."

Here's how I put this together from the info you posted:

The script generated detailed descriptions of the IIS objects.  In the Sites.txt I see this:


applicationPool            : DefaultAppPool
enabledProtocols           : http
physicalPath               : D:\GRACE TEACHINGS
ItemXPath                  : /system.applicationHost/sites/site[@name='Grace' and @id='3']
** this gives me the site name and the AppPool that it is using.

Then the output of the appcmd commands for the AppPools indicates that the DefaultAppPool is stopped.


APPPOOL "DefaultAppPool" (MgdVersion:v2.0,MgdMode:Integrated,state:Stopped)
APPPOOL "ASP.NET v4.0" (MgdVersion:v4.0,MgdMode:Integrated,state:Started)
APPPOOL "ASP.NET v4.0 Classic" (MgdVersion:v4.0,MgdMode:Classic,state:Started)
APPPOOL "Grace" (MgdVersion:v2.0,MgdMode:Integrated,state:Started)

So, I recommend 1 of 2 things... either start the DefaultAppPool or reconfigure the Grace website to the use AppPool named Grace.

Let me know the outcome...

Dan

Author

Commented:
Dan,

You sir, ARE THE MAN,

I actually tried it both ways and it worked flawlessly.

Thank you very much for your patience.

One more question, are any of the free webpage templates available on the web worth messing with?

I'd like to at least make the page a little more appealing than an ftp page....... :)
Systems Engineer
CERTIFIED EXPERT
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Dan was excellent in helping me decipher what was happening within IIS. With no background in IIS, he helped GREATLY in resolving the issues and helped in obtaining a functional website.
His help is very much appreciated.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.