iisruntime-errorcustom-errorsserver-error

Runtime Error while Accessing IIS virtual directory on another server through localhost/folder


We have 2 servers, In server1, IIS configuration has a virtual directory which has the HTML page of the URL.

In server2, IIS configuration the virtual directory points to the directory in server1(same directory configured in server1).

while accessing the URL by localhost in server1 displays a General error as mentioned in the config file, whereas accessing the URL by localhost in server2 displays Runtime error(mentioned below) although it points to the same config which server 1 points. There is no access issue between the servers.

Server Error in '/' Application

Runtime Error:

Description: An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page for the first exception. The request has been terminated.

Web Config:-

<customErrors defaultredirect="GeneralErrorPage.htm" mode ="On">
<error statuscode="404" redirect="GeneralErrorPage.htm"/>
</customErrors>
  1. set <customErrors mode="Off" /> and
  1. The virtual directory buyer in IIS has lot of *.html pages Hosted the url in server1 and server 2 as http://localhost/buyer/info.html displays the UI page of the buyer info

Its very clear that server2 has no issues while accessing the directory "buyer" in server1.

  <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
         
            <httpErrors errorMode="Custom">
                <remove statusCode="404" subStatusCode="-1" />
                <remove statusCode="403" subStatusCode="-1" />
                <error statusCode="403" prefixLanguageFilePath="" path="/GeneralErrorPage.htm" responseMode="ExecuteURL" />
                <error statusCode="404" prefixLanguageFilePath="" path="/GeneralErrorPage.htm" responseMode="Redirect"  />
               
            </httpErrors>
            <directoryBrowse enabled="false" />
       </system.webServer>
    <system.web>

      <customErrors defaultRedirect="GeneralErrorPage.htm" mode="Off">
       <error statusCode="404" redirect="GeneralErrorPage.htm"/>
      </customErrors>

</system.web>
</configuration>

Note: Manually When I append the html pages (GeneralErr.htm) in the same url http://localhost/subtest/GeneralErr.htm, the page gets loaded sucessfully.

But While hosting the url http://localhost/subtest from server 2 getting the below error - Getting access error or runtime error

Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred loading a configuration file: Failed to start monitoring changes to '\server1\c$\test\subtest' because access is denied.

Regarding IIS configuration for virtual directory using IIS8 version

In Server1 folder structure: c:\test\subtest

In Server2 : IIS configuration for virtual directory "subtest" Physical Path : \server1\c$\test\subtest Physical Path Credentials: domain\username Virtual Path: /subtest


Solution

  • The 500.19 error you get at the beginning is just like the error description says that absolute paths are not allowed, but relative paths should be used. So you can set the relative path to solve this problem, or enable the absolute path in applicationhost, follow the underlined part of the configuration.

    <httpErrors allowAbsolutePathsWhenDelegated="true" errorMode="Custom" lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
      ...
    </httpErrors>
    

    Even if the relative path is enabled, there will still be problems when accessing through localhsot/subtest.

    There are two ways to solve this problem, one is to modify the application pool to “No managed code" and "Classic" settings. The other is to modify the identity of the application pool, set it to a user with the same permissions as the administrator, you can create one User or directly use the administrator.