IIS: System.UnauthorizedAccessException: Access to the path

Luckbox72 picture Luckbox72 · Aug 5, 2015 · Viewed 19k times · Source

I have a website and it sits on the IIS Server and I have a folder on another server the file server. I have set the Virtual directory to the folder on the fileserver. This application both servers are on the same domain, but in the future I will have serves that are not on the same domain.

I have tried to set up local users on both machines and set up the app pool to use the local accounts and I get

System.UnauthorizedAccessException: Access to the path is denied. and 401 - Unauthorized: Access is denied due to invalid credentials. You do not have permission to view this directory or page using the credentials that you supplied.

I have set the virtual to connect as the local user and get the same error.

I have setup a domain user and then set the app pool to use the domain user and set to use pass through and when I test the settings in Directory Browsing it says everything is good but I get the same error from the webpage.

I have setup a domain user and then set the app pool to use the domain user and set to the connect as to the user and when I test the settings in Directory Browsing it says everything is good but I get the same error from the webpage.

I have set the apppool to use my login and it works with pass through permissions.

Is there something I am missing.

Answer

nimeshjm picture nimeshjm · Aug 5, 2015

You need to set the folder permissions in your separate folder to give access to the "computer$" account of the server where your application is hosted.

See here: https://www.iis.net/learn/manage/configuring-security/application-pool-identities

application pool identities also use the machine account to access network resources.

So in the server where you have your data files you should set the folder permissions to allow access to the machine name where your website is hosted.