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

  • Question

  • User1133548109 posted

    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:-

    <?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>


      

    Wednesday, October 21, 2020 12:42 PM

All replies

  • User-939850651 posted

    Hi mariaprabudass,

    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.

    According to your description, we created the environment as you mentioned using the server 1 folder as virtual directory under server 2 site.

    When using virtual directory under the site it change the folder path from the before. E.g. on server 1 it is c:\test and after adding on server 2 as

    virtual directory sitebinding\virtualdirname.

    Here is the test result:

    So I think your IIS configuration is inconsistent with the Web.Config configuration, which causes the problem.

    If possible, could you share how configured your virtual directory in server 2 and what is the custom error page location?

    Best regards,

    Xudong Peng

    Thursday, October 22, 2020 10:18 AM
  • User753101303 posted

    Hi,

    This is just a generic error message. When  it happens use https://stackify.com/beyond-iis-logs-find-failed-iis-asp-net-requests/ and here likely the Windows event log to get full details about the error and better understand what happens exactly.

    I'm not sure your current approach is supported. I know it could be done using https://docs.microsoft.com/en-us/iis/web-hosting/scenario-build-a-web-farm-with-iis-servers/configuring-step-2-configure-iis-web-farm-servers which is a bit different. If you need further help asking at https://forums.iis.net/ coould be better.

    Thursday, October 22, 2020 10:59 AM
  • User1133548109 posted
    Regarding IIS configuration for virtual directory
    using IIS8 version

    In Server1
    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

    Webconfig:
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <directoryBrowse enabled="true" />
            <httpErrors>
                <remove statusCode="500" subStatusCode="-1" />
                <remove statusCode="404" subStatusCode="-1" />
                <error statusCode="404" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="404.htm" responseMode="File" />
                <error statusCode="500" prefixLanguageFilePath="%SystemDrive%\inetpub\custerr" path="500.htm" responseMode="File" />
            </httpErrors>
       </system.webServer>
    <system.web>
     <customErrors mode="On" defaultRedirect="/GeneralErr.htm">
       </customErrors>
    </system.web>
    </configuration>

    Edit Custom Error page:
    Initial setup : For 500 error,Insert content from static file is checked with the "%SystemDrive%\inetpub\custerr\500.htm"
    As per your screenshot modified as checked "Respond with 302 redirect" with the value /subtest/GeneralErr.htm

    While launching the http://localhost/subtest ,I am getting error
    HTTP Error 500.19 - Internal Server Error
    Absolute physical path "C:\inetpub\custerr" is not allowed in system.webServer/httpErrors section in web.config file. Use relative path instead.

    Error:
    HTTP Error 500.19 - Internal Server Error
    Absolute physical path "C:\inetpub\custerr" is not allowed in system.webServer/httpErrors section in web.config file. Use relative path instead.

    Most likely causes:
    The worker process is unable to read the applicationhost.config or web.config file.
    There is malformed XML in the applicationhost.config or web.config file.
    The server cannot access the applicationhost.config or web.config file because of incorrect NTFS permissions.

    Thank You

    Thursday, October 22, 2020 4:49 PM
  • User753101303 posted

    Hi,

    Try https://stackoverflow.com/questions/2472818/500-19-error-in-iis7-when-an-error-occurs: the IIS configuration is hearchical and you allow or deny changes done at a lower level. It seems you have a particular attribute to allow the use of physical paths (likely for safety reasons).

    Edit: look in particular at

    allowAbsolutePathsWhenDelegated
    Thursday, October 22, 2020 5:20 PM
  • User1133548109 posted

    500.19 error has gone after implementing the resolution provided,while hosting the url http://localhost/subtest from server 2 getting the below 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.

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

    Note: 
    1.http://localhost/subtest   - Getting access error or runtime error
    2.http://localhost/subtest/GeneralErr.htm  - launched successfully

    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

    Friday, October 23, 2020 3:19 PM
  • User-939850651 posted

    Hi mariaprabudass,

    500.19 error has gone after implementing the resolution provided,while hosting the url http://localhost/subtest from server 2 getting the below error

    Regarding your current issue, you could try to set the iis_iusrs and iusr permission to the shared folder.

    In addition, you also need to assign the iis application pool identity to the custom user and set domain username and password.

    Something like this:

    Best regards,

    Xudong Peng

    Monday, October 26, 2020 6:34 AM