Inaccessible virtual directory results in a 500.19 error reporting a missing web.config file and rewrite rules not triggered

Viewed 132

We have a "Resources" virtual directory which is mapped to an NFS folder.

We also have a rewrite rule which is triggered on specific requests to "Resources\Images..." which redirects to a different url. This new url is then then handled by routing.

All other requests to the "Resources[any other folder + filename]" are all served by IIS as expected.

Note: We also have an additional handler which is directing urls that include a file entension to the routing handler (IIS automatically captures requests with filename and extension).

Under normal circumstances this is working fine. The problem is that sometimes the NFS folder becomes unavailable and the result is that IIS appears to then try to access a web.config file from within the "Resources" virtual directory. The virtual directory does not have a web.config file in it. The request ultimately times out and with a 500.19 error.

enter image description here

We were hoping that any requests to "Resources\Images..." would still be processed by the rewrite rule, but IIS is not letting it get this far and is first trying to load a web.config file (for any requests to the "Resources" folder), which is not available and then just times out with the 500.19 error.

Within the applicationHost file we have tried setting the virtualDirectoryDetaults.allowSubDirConfig to false at the root level, and also at many other levels including on the virtual directory itself and this does not stop IIS from trying to load a web.config file from the virtual directory.

Is there any other way to stop IIS from trying to load a web.config file from a virtual directory? Or is there any way to ensure that the rewrite rules are triggered before IIS tries to inspect the directory?

0 Answers
Related