I'm trying to do a really simple task - setup a virtual directory in Windows Server 2008. This is what I am doing but it's not working for some reason:

  • Open IIS 7
  • Create a new virtual directory in Default Web Site and point it to a folder on d:\ drive
  • Browse to folder on d:\ drive and create an .htm file with some test text in it
  • Open a browser and navigate to http://localhost/TestSite/index.htm

But I get a 404 - what gives?

Edit:I didn't mention at first that this is Server 2008 R2

link|improve this question

Double check that your browser is not set to go through a proxy. If it is, bypass the proxy for localhost. – Bork Blatt Jun 10 '09 at 13:52
Can you browse to a htm file if you place it in the root of the site? – Sam Jun 10 '09 at 14:55
no. that's what i've been trying to do all along. just get iis to serve me up one simple html page. – Tone Jun 10 '09 at 23:46
Ok, so its not a problem with the virtual folder, but with IIS and the site. – Sam Jun 11 '09 at 10:49
feedback

8 Answers

Did you set up correct permissions on the folder ?

IUSR and/or IIS_IUSRS should have at least read permissions.

link|improve this answer
Also, in the advanced settings of the virtual directory, check the Physical path, the virtual path and the Credentials Logon Type (should be ClearText by default) – Berzemus Jun 10 '09 at 12:32
both users have been added with full permissions, the advanced settings you recommended to check all look correct. – Tone Jun 10 '09 at 12:58
Don't forget ICACLS: adopenstatic.com/cs/blogs/ken/archive/2008/01/29/15759.aspx – bzlm Oct 8 '09 at 20:48
feedback

In basic settings, click the "test settings" button and see what that says. I think I've had a similar problem and it was permissions related.

Try checking the "connect as" or check the identity of the app pool

link|improve this answer
ah ha! Getting closer.. Something is wrong with the passthrough authentication. I get this when I click Test setting: The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access....yadayada. I clicked Connect As and changed the user to the administrator account and the Test Settings works, but it still won't serve up a file. This is a stand alone machine (not on a domain). I also tried setting up a site in c:\inetput\wwwroot and get the same behavior – Tone Jun 11 '09 at 1:17
Have you checked the application pool's identity? Are you getting a different message or the 404 still? – user8042 Jun 11 '09 at 13:05
i have 2 app pools setup - Classic .NET AppPool and DefaultAppPool. I've tried both and still get the 404. What exactly do you mean by checking the apppools identity? – Tone Jun 12 '09 at 11:47
i found this in the event log dated this morning (just after a reboot): The World Wide Web Publishing Service (WWW Service) did not register the URL prefix http://*:80/TestSite for site 1. The site has been disabled. The data field contains the error number. – Tone Jun 12 '09 at 11:55
feedback
up vote 1 down vote accepted

I figured it out. I had installed Collabnet Subversion and it automatically setup something to handle the web client source control stuff. I uninstalled, rebooted and voila! Thanks to everyone for all your replies and suggestions.

link|improve this answer
feedback

You're file index.htm may be index.htm.txt if extension hiding is enabled at your system.

Greetz, GHad

link|improve this answer
Didn't think of that ^-^ Could be it, though. – Berzemus Jun 10 '09 at 12:34
nope. no .txt on the end. – Tone Jun 10 '09 at 12:52
Well, I tried... sorry I couldn't help – GHad Jun 10 '09 at 13:03
feedback

Try just http://localhost/index.htm

Let's say I created a folder:

d:\Webs\TestSite
and put index.htm in that folder. Then I point the default web at that folder. I don't need to include "\TestSite" in the URL because that is the root folder of my web site.

I suspect this is the problem in your case.

link|improve this answer
no because i created a new website called TestSite under Default Web Site - thanks for the suggestion though. – Tone Jun 10 '09 at 12:55
Whoops. I'll read the question more carefully next time. – Bork Blatt Jun 10 '09 at 13:44
feedback

Is the name of the virtual directory really "TestSite" or is only the name of the filesystem folder on d: "TestSite" and you gave the virtual directory a different name?

It's very unlikely, but you could check this: is the file extension/mime type .htm allowed? Maybe somebody very restrictive removed it from the allowed extension from the default web? Try to put a .txt or a .html file in that directory.

UPDATE:

Another possible reason which same to my mind: the default web hasn't the "blank" host header or is restricted to a single IP address which is not 127.0.0.1. Or the default http port (80) was changed to some other value.

link|improve this answer
Both the virtual directory and the physical path are named TestSite. If i open the .htm file directly from the folder then it opens fine in a browser. I added 2 more files as you suggested just to see if that worked, and alas, it did not. This is a new install of Server 2008. and I've setup websites a hundred times before this. It's probably something really simple I'm just overlooking... Thanks for the suggestions. – Tone Jun 10 '09 at 14:17
i should clarify that - I've setup websites a hundred times before on other servers. – Tone Jun 10 '09 at 14:18
feedback

try http://yourcomputername/testsite/index.htm

link|improve this answer
didn't work, thanks. – Tone Jun 11 '09 at 1:17
feedback

Are you able to browse to http://localhost/ succesfully?

If you turn on directory browsing for TestSite, can you browse to http://localhost/TestSite/ successfully?

A 404 error is very clear cut. It's file can not be found, so it's something in the configuration. I'd suggest blowing it away and giving it a 2nd shot.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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