IIS: System.UnauthorizedAccessException: Access to the path

21,991

Solution 1

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.

Solution 2

I had this same challenge when deploying a web app using IIS on a Windows 2012 Server.

The issue was the App Pool Account did not have Full rights to the Website Root.

All I had to do was to go to the directory where the Website Root resides and then right-clicked on it. Next, I selected Security and then gave the IIS-Users group full access to the directory.

For me IIS-Users group contains all Users/App Pool Accounts that are created in IIS.

That's all.

I hope this helps

Share:
21,991
Luckbox72
Author by

Luckbox72

Been in IT for over 20 years, mainly programming and mainly Microsoft technologies

Updated on March 28, 2021

Comments

  • Luckbox72
    Luckbox72 about 3 years

    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.