Directory browsing without using a web.config on IIS 7.5 - asp.net

I'm trying to set up directory browsing for a file share to which my IIS server (7.5 on Windows 2008) has read-only access. I have tried configuring directory browsing using the IIS Manager, and also by directly editing the \Windows\system32\inetsrv\config\applicationHost.config file.
Despite my best efforts each time I attempt to view my virtual directory in IE I am met with a HTTP Error 500.19 (Cannot read configuration file) exception. It appears that IIS is attempting to locate a web.config file in the physical file share (which obviously doesn't exist).
Given that my file share will only ever be read-only, is there any way to configure directory browsing on my virtual directory without the requirement for a web.config file in the physical directory?

After spending considerable time on this I finally conceded to the HTTP 500.19 error. Despite my best efforts to convince it otherwise, IIS insisted on the web.config being present in the file share.
I ended up writing my own file system wrapper which essentially produced the same output as the default directory browser, and then deployed it with a dedicated service account with read access.

Related

HTTP Error 500.19 - Internal Server Error 0x80070003 Cannot read configuration file

I'm getting the above error when I publish my application and move it from development to production server. Below are the error details.
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\C:\inetpub\wwwroot\WorkmenCompTest\web.config
Requested URL http://localhost:80/wictest
Physical Path C:\inetpub\wwwroot\WorkmenCompTest
Logon Method Not yet determined
Logon User Not yet determined
This website used to work previously but recently the published version stopped working due to this error. As far as I can tell, the only change was installing iTextSharp and iTextSharp xmlworker through nuget.
I have tried, without success:
giving modify permission on the site folder to Everyone
checking the web.config file, and using an older version of the web.config file (from when the site worked).
uninstalling iTextSharp and iTextSharp XMLWorker
The project still runs without issue from Visual Studio.
This is solved. The error was caused by the folder name not matching the path for the virtual directory. Oh wow I feel dumb.
Check the applicationhost.config file under - .vs\lpsWeb-UI\config folder of your application root.
Under sites section of the config file check what the physical path points to.
If you modify those you should be able to fix the issue.
This is because of different physical path in the IIS.To change the physical path of application content
You can perform this procedure by using the user interface (UI), by running Appcmd.exe commands in a command-line window, by editing configuration files directly, or by writing WMI scripts.
User Interface
To use the UI
Open IIS Manager. For information about opening IIS Manager, see Open IIS Manager (IIS 7).
In the Connections pane, expand the Sites node and click to select the site in which your application runs.
In the Actions pane, click View Applications.
On the Applications feature page, select an application from the list and then click Basic Settings in the Actions pane.
In the Physical path box, change the path of the application content.
Click OK.
DefaultAppPool application pool runs under the Network Service account. This account is local to the computer and this account does not exist on another computer. Make sure that you configure the DefaultAppPool application pool to use an account that is a domain user. Then, you can use the same account on the WorkmenComp file server. Alternatively, you can create a workgroup account on the WorkmenComp file server.
I am getting this HTTP Error 500.19 error when I am giving physical path as Z:\App_Live in IIS
Instead of using z:\ ,
I used network path \\server\share\live_folder in the IIS physical path – something like this \\server\share\wwwroot\inetpub\wwwroot
Also you may need to specify username/password in "connect as".

IIS8 looking for web.config in virtual directory rather than app root

I have a Virtual Application in IIS8, http://localhost:80/application/, the files for which are located in C:\inetpub\wwwroot\application. There is a web.config file in the ~/application/ folder.
Under the application, I have a virtual directory, http://localhost:80/application/vdir/, the files for which are located in J:\virtual_directory.
When I try to access a file under the /vdir/ directory, I get HTTP Error 500.19 - Internal Server Error, it says it cannot read configuration file at \?\J:\virtual_directory\web.config
Why is it looking for the web.config file there, rather than C:\inetpub\wwwroot\application\web.config? I have never had this problem in IIS 7, this is my first time setting this up on a Windows 2012 server.
(Note: J: is mapped to a shared folder on the network. Not sure if that makes a difference?)
Okay, turns out I had to do two things:
Create the virtual directory using the UNC path (\\servername\sharedfolder) rather than the mapped drive letter
use a network account in the Physical Path Credentials under advanced settings rather than the default Pass-Through Authentication

IIS 7 Strangeness

I'm working on a project which has been successfully deployed to a local instance of IIS7.
When I type in the wrong URL I get an error 404 (as expected). Both fiddler and the web config both tell me that the error page is located at /site/service/error.aspx however this file does not exist anywhere within the server's physical path.
As far as I can tell there are no redirection rules set up on the server and no handlers / modules.
So where is this file? And (more importantly) How can the server access it if it's outside the server's root?
It sounds like this is being configured in the <customErrors> node of an upstream *.config file.
You should check the upstream files such as machine.config or ApplicationHost.config.
This MSDN article covers all of the config files in the hierarchy and where they can be found on disk.

IIS 7.0 on windows 2008 server. 500.19 error

I tried setting up a virtual folder on IIS7.0 on windows 2008 server.
when trying to browse the aspx pages, i received an error like "HTTP Error 500.19 - Internal Server Error" and had few more lines saying the config file is incorrect.
Few google results pointed to applicationHost.config file might be incorrect.
just by trial and error I checked up the space in the server and found its just having 1MB free space.
SO freed up 1 GB space and then the error was gone
My question:
whenever a website is accessed first time in IIS7.0 does it try to update applicationHost file?
what is the role of applicationHost in IIS7.0
The 500.19 error is indeed caused by errors in configuration files but not necessarily applicationHost.config, it can also be caused by errors in the web.config file for the application or any web.config file that applies to the application/virtual folder/site
Link to MS Support article about this error - http://support.microsoft.com/kb/942055
The following link is to an article that introduces the applicationHost.config file -
http://learn.iis.net/page.aspx/128/iis-7-configuration-reference/
If you read it you'll see that the main role of the file is to configure the general setup of the web server and control what configuration can be overridden in web.config files. It also tells IIS all the Sites, Virtual Folders and Applications that are running on it.
Given that your web server has a measly 1MB free space (how did you get that low without the entire machine crashing!!??) I would suspect that IIS 7 may do something with the file and was unable to update it on disk correctly due to the lack of space leading to the corrupted configuration.

IIS7 Creating Virtual Directory to files on another server

I am migrating some ASP.Net applications from IIS6 to IIS7 and all has gone well until now. I am trying to create several virtual directories on 1 server that will point to files on another server. In IIS6, all I had to do was make anonymous authentication use a user that had access to the files. In IIS7, I can't get it to work. I setup the virtual directory with the username and password but I get a 500.19 error "Cannot read configuration file due to insufficient permissions". I can't imagine that I really have to put a web.config in a directory that just contains images and no application files. If I click on the directory in IIS Manager, I get that error about the web.config file on anything that I click on such as the Authentication section. Also, writing to files from the virtual directory seems to work just fine so I don't think there is anyway that I have an access problem. I have given the directory access to the IIS_IUSR group.
When using a virtual directory that's pointed to a UNC share, go to advanced settings for the virtual directory, then choose a specific user account that has the appropriate rights to access the folder.
It works for my virtual directory in my asp.net app that is pointed to a UNC share on a remote server.

Resources