I have a folder location that contains .txt files (say C:\Files). I need to be able to access it using http://localhost/Files/myFile.txt

I created a Virtual directory and mapped it to C:\Files. However, when I browse to the .txt file using the URL, it gives me an error. It appears that its looking for web.config file. I tried creating an application in IIS with the same result.

EDIT

alt text

link|improve this question

67% accept rate
What error is it giving you when you try to access it? – techie007 Feb 3 '10 at 19:58
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. – user25164 Feb 3 '10 at 20:10
Do I have to set it up as a ASP.NET website? Can't I just have files in the physical path? – user25164 Feb 3 '10 at 20:14
feedback

1 Answer

up vote 2 down vote accepted

IIS 7 will always try to walk directories to look for additional config data (stored in web.config files).

You're throwing a 500.19 because the security context that your worker process is running under does not have rights to check if the web.config file exists in c:\files.

You need to grant NTFS permissions to your worker process to read from that location.

Depending on the version of windows and your worker process configuration granting Read/list folder contents to the IIS_IUSRS group is probably what you need.

Feel free to reply back with your windows/IIS version and the security context that your worker process is running under (Application Pools -> Identity) if the above suggestion doesn't work.

link|improve this answer
After adding IIS_IUSRS rights, I get HTTP Error 401.3 - Unauthorized error. I am on Win Vista/IIS7 and this is my dev machine. I will need to get it to work on Windows Server 2008/IIS7 – user25164 Feb 3 '10 at 20:36
What is the security context that your worker process is running under? (Application Pools -> Identity column). What authentication methods are enabled for the Virtual Directory? (expand the site -> click the virtual directory on the left pane -> select the Authentication icon under the IIS heading) – Dominic D Feb 3 '10 at 20:39
NetworkService is the security context. Anonymous Auth enabled. – user25164 Feb 3 '10 at 20:43
For what it's worth - this is currently a Virtual Dir (and not an application) – user25164 Feb 3 '10 at 20:44
A virtual directory is fine if you're just trying to display static content. A screenshot of the detail of your exact 401.3 error and the permissions window of the c:\files\ folder would be helpful. – Dominic D Feb 3 '10 at 20:54
show 10 more comments
feedback

Your Answer

 
or
required, but never shown

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