There is a question that I have been seeing more of in recent weeks. While it comes in different varieties, the essence of it has to do with having your files located on a server or device other than the IIS web server.
One variety of the question has to do with connecting to the files through a mapped drive. This configuration is not supported although I tried to get this to work through extensive testing without success. Your mileage may vary. The recommended way to load remote files in IIS is through a UNC share. The rest of this post will focus on implementing that scenario.
Once you have the website setup, go into the advanced properties and change the physical path for the site to point to a UNC share.
At this point if you try to load the website you will get a 500.19 HTTP Internal Server Error – The requested page cannot be accessed because the related configuration data for the page is invalid. That is expected since we’re not done configuring it.
The next thing we need to do is set proper permissions across the UNC path so that IIS can access the files across the network. Once again under the Advanced Settings for your site, click on the ellipses button to the right of Physical Path Credentials. While you can use pass-through authentication, it is more involved to setup depending on how your application pool is setup. To make the process as easy as possible, I recommend using a specific user.
Select the radio button to Specific user: and click on the Set… button. This will present you with a Set Credentials window. For ease of use, it is recommended that you use an active directory user for this step. If your servers are not in an active directory domain or if you prefer otherwise, you can create a local user on each of the servers, ensuring that their name and passwords are identical. Enter the username and password here and click OK.
Next we need to move on to the remote server where the files are located. Once you have navigated to the folder that contains the files, right click it and choose Properties. In the Properties window for the folder, click on the Sharing tab. Here you can click on the Share button but I prefer to have more granular control over the sharing. Click on the Advanced Sharing button instead to bring up the Advanced Sharing window. Check the box to Share this folder and choose the Share name that you want.
Next click on the Permissions button. By default Everyone is given Read access. Make sure Everyone is highlighted and click Remove. Click the Add button and enter the user that you set on the web server to Connect As. Make sure that user is highlighted and give this user Change and Read permissions. Click OK a couple of times to get back to the properties window for the folder.
Setting up the share and permissions on the share are not enough. We will need to assign permissions at the NTFS level. We’ll do this by clicking on the Security tab. Click Edit and Add to select the same user that we used above. In most cases from my experience, you’ll also want this user to be able to modify the files so you’ll want to check the box under modify.
Click OK and Close. Now you can test your site by navigating to it.
Read the complete post here