Search code examples
asp.netasp.net-mvciis-7webformsvirtual-directory

Runtime Error when accessing virtual directory on remote server IIS7


I'm having issues with a virtual directory mapped to a folder on a remote server. Basically what I want to do is to fetch an xml file located on the remote server through a request to a web server, e.g http://example.com/Archive/file.xml, where "Archive" is a virtual directory pointing to a folder on the remote server. I'm not using application/pass-through authentication.

When the virtual directory points to a local folder on the web server machine everything works fine.

I have another site running on the same server, difference being that this other site (where the virtual directory mapping to the remote server works fine) is a Web Forms site and the one I'm having trouble with is a .NET MVC site. My first idea was that there's something fishy with routes configured for the MVC site, but in that case it wouldn't work when the archive is mapped to a local folder (I suppose).

So, the question, what am I missing? It seems to be something in the IIS configuration...

Web server setup: Windows Server 2008 Standard, IIS7, Site running on .NET MVC

File server setup: Windows Server 2008 Standard

(both servers are on the same subnet and can reach each other on 192.168.0.X)


Edit: After adding a web.config to the folder on the remote server, I get this error instead. Permissions are, from what I can tell, correctly configured:

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 '\\fileserver\c$\inetpub\wwwroot\Archive\fileDir' because access is denied.

Source Error: 


[No relevant source lines]

The web.config in fileDir looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <staticContent>
        <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
    </staticContent>
</system.webServer>

Looking in the Windows Event Viewer I find the following application error:

Failed to start monitoring changes to '\\fileserver\c$\inetpub\wwwroot\Archive\fileDir' because access is denied.

Solution

  • Just an update as I found this old question and remember how it was solved:

    The problem was with our internal DNS server which has been a pain ever since it was introduced. Accessing the remote directory on its IP instead solved the problem.

    Cheers!