While I am attempting to save static files in the wwwroot, my aspnet core app throws:
UnauthorizedAccessException: Access to the path <path> denied.
I have already found the solution here: https://stackoverflow.com/a/48935373/8475133, but I cannot get the right application pool name: DefaultAppPool and IIS AppPool\DefaultAppPool does not work. Where to find it?
Open IIS Manager, select your website in left hand pane, and then click Basic Settings
in the right hand pane. It will display a modal dialog and from here you can find the Application pool used by your application Pool
Next, select the Application Pools in left pane, and the then click Advanced Settings
in right pane. It will show the Application Pool properties. Identity
property is set to ApplicationPoolIdentity
Note: Since you are deploying ASP.NET Core application ensure your .NET CLR Version
property is set to No Managed Code
Next for setting the write permissions for Application Pool User, select your website in left pane, right click and then click Edit Permissions
. In the opened dialog box, go to the Security tab and then click Edit
. Click Add
and then type in the Application Pool Identity user. The format for Application Pool user is IIS AppPool{Application pool name} for example for DefaultAppPool the username will be IIS AppPool\DefaultAppPool
. Next click on Check Names
button and in case of valid name the username will be underlined in the TextArea. Finally click OK
.
Next with the IIS App Pool user selected, check the Modify
checkbox and click OK.