I have a loadbalanced web server where I'm trying to setup a virtual directory on one server (server02) to a network share on the other server (server01). Both servers are IIS 7 on Windows 2008R2. They are not part of a domain.

I setup the virtual directory on server02 connecting to the network share as an administrator of server01 (for testing purposes).

In IIS, I can browse the files that are in the virtual directory. When I click "Test Settings" in the virtual directory basic settings there are no errors and the virtual directory can connect to the share without problems.

However, when I'm trying to request a file (http://server02/media/image.jpg) through the virtual directory I get this configuration error "An error occurred loading a configuration file: Failed to start monitoring changes to '\\server01\media' because access is denied.".

I have no idea what causes this because according to IIS the connection is ok.


The user account that your site's application pool is running as needs to have permission to that share. Change that to an account with rights to that share and you should be fine.

Also, whats the point of load balancing your web servers if you're going to have server01 be a single point of failure? You should replicate that data or cluster the web servers with shared storage instead. What you're trying to do is not a very good idea.

  • I can't select users from server02 in server01 file/share permissions (probably because they are not part of a domain). Besides, shouldn't it just work when I set credentials on the virtual directory? The credentials work, I can browse the files from IIS. – Carvellis Sep 14 '12 at 10:23
  • You need a domain to do this. Not sure why your follow up question means. – MDMarra Sep 14 '12 at 10:41
  • As mentioned in the question, they are not part of a domain. I have configured the virtual directory to connect to the share with a user that has rights on the share. As I can browse the remote files in IIS, I was expecting to be able to request them through a browser as well. – Carvellis Sep 14 '12 at 10:55
  • "I have configured the virtual directory to connect to the share with a user that has rights on the share" - Please explain this further. If you don't have a domain setup, a user on one machine cannot access files on another unless you use passthrough auth (same user/password on both servers). Do you mean that you mapped the drive when logged in locally and you expect IIS to be able to use this mapping? – MDMarra Sep 14 '12 at 12:39
  • I didn't map a drive, the virtual directory maps directly to the share. It is configured to use impersonation (Physical Path Credentials setting) with a user (\\server01\shareuser) that exists on the server that hosts the share. It can access files on the other server, and I can browse these files from within IIS. I don't know if IIS actually uses the impersonation credentials or the currently logged on user credentials to browse a virtual directory. – Carvellis Sep 14 '12 at 12:55
  1. add a local user with same password on both systems
  2. Grant access to that user on the share
  3. On your webserver, run your application pool under that username.

if you are auto scaling your servers than you will want to do this in code you can do the following:

net.exe user  MyNewLocalUser Password! /ADD
net.exe share MyNewShare=C:\MyPath /Grant:MyNewLocalUser,full

if you are spinning up your webserver on the fly you can use the following code to create the virtual directory and change the application pool to the new user.

            Using mgr As New ServerManager
            Dim MainApp As Site = mgr.Sites(SiteName)
            mgr.Sites(SiteName).Applications(0).VirtualDirectories.Add("/MyVirDir", "\\server\share")

            Dim appPool As String = Nothing
            For Each app In MainApp.Applications
                appPool = app.ApplicationPoolName

            Dim myAppPool As ApplicationPool = mgr.ApplicationPools(appPool)
            myAppPool.ProcessModel.IdentityType = ProcessModelIdentityType.SpecificUser
            myAppPool.ProcessModel.UserName = "MyNewLocalUser"
            myAppPool.ProcessModel.Password = "Password!"

        End Using

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.