system.unauthorizedaccessexception access to the path .net core edit button Edit

Murugan Andezuthu Dharmaratnam | calendar 18 March 2021 | 2536

In my asp .net core 5.0 MVC application, everything was working fine while I was running the app using visual studio. But I get this error system.unauthorizedaccessexception access to the path when I deployed to the server on iis. Specifically, I was getting this error when I was trying to create a folder using code.


The solution was simple. The only thing I had to do was to give full permission to wwwroot folder.

  • go to root folder where application is loade
  • right click on wwwroot folder and select properties
  • go to security tab
  • select IIS_IUSRS and click on edit
  • select IIS_IUSRS
  • on the Permission for IIS_IUSRS
  • check and Give full permission