DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Access denied error after use backup files

 1 Replies
 0 Subscribed to this topic
 33 Subscribed to this forum
Sort:
Author
Messages
New Around Here
Posts: 3
New Around Here
New Poster
New Poster
Congrats on posting!

I want to share an experience I had that was eventually resolved by following a series of steps that I think are worth knowing for those who aren't so experienced.

I was using DNN Platform v.09.08.01 and proceeded to perform the available upgrades in v.09, which is higher than the version I was using, since my Windows Server and SQL Server don't support the DNN Platform v10.0 upgrade.

As a matter of habit, I always perform the upgrades one by one, with the corresponding backup of the files and database on an external drive that I use for this purpose, so I maintain a physical copy of everything.

Once I applied the upgrade, I tested that everything was working correctly and proceeded with the next available update.

Everything was working as it should, and since I was already on version 9.13.01, I decided to install version 10.0.0. I did this without reading the documentation for the upgrade requirements, and to my surprise, the update failed, as expected.

I thought, well, I'll restore both the files and SQL from the backup. Once I did this, I tested the websites and saw that everything was working correctly.

Days later, I needed to update some SQL code in an XMod Pro template, and I noticed that when I saved, I got an error: "Access Denied."

I started trying everything I could find that might help, but nothing worked. I also discovered thousands of messages with the same error in the log for different automatic process.

The real problem:

When you copied the files from the external backup disk drive, Windows probably:

1. Inherited permissions from the external disk (which are different)
2. Lost explicit permissions from the IIS Application Pool Identity
3. The "Owner" being Administrator is not enough - **IIS does not run as Administrator

Step-by-Step Solution
1. Identify the Application Pool Identity
First, you need to know which account your Application Pool is running under. Open IIS Manager, go to Application Pools, select the one your DNN site uses, and check the "Identity" column. It's typically IIS AppPool\PoolName or NetworkService.

2. Apply Correct Permissions (This is what you really need)
Open PowerShell as Administrator and run the following command for each DNN site:

$sitePath = "C:\inetpub\wwwroot\YourDNNsite"

$appPoolName = "YourAppPoolName"

 

# Grant full permissions to the Application Pool Identity

icacls $sitePath /grant "IIS AppPool\${YourAppPoolName}:(OI)(CI)M" /T

icacls $sitePath /grant "IUSR:(OI)(CI)R" /T

icacls $sitePath /grant "IIS_IUSRS:(OI)(CI)R" /T

 

3. Special permissions for critical DNN folders
DNN requires write permissions in certain specific folders:

$sitePath = "C:\inetpub\wwwroot\YourDNNsite"

$appPoolName = "YourAppPoolName"

 

# Folders that DNN MUST be able to write to

$writeableFolders = @(

    "App_Data",

    "Portals",

    "DesktopModules",

    "Images",

    "Install",

    "Logs"

)

 

foreach ($folder in $writeableFolders) {

    $fullPath = Join-Path $sitePath $folder

    if (Test-Path $fullPath) {

        icacls $fullPath /grant "IIS AppPool\${YourAppPoolName}:(OI)(CI)F" /T

        Write-Host "Permissions applied to: $fullPath" -ForegroundColor Green

    }

}

This is the one I use

4. Quick alternative solution (if the above doesn't work)
If you want to get straight to the point without complicating things:Open CMD as Administrator and run this:

icacls "C:\inetpub\wwwroot\YourDNNSite" /reset /T /C

icacls "C:\inetpub\wwwroot\YourDNNSite" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T

icacls "C:\inetpub\wwwroot\YourDNNSite" /grant "IUSR:(OI)(CI)RX" /T

icacls "C:\inetpub\wwwroot\YourDNNSite" /grant "IIS_IUSRS:(OI)(CI)RX" /T

The /reset command clears inherited permissions and reapplies them from scratch. This will take a few minutes depending on how many files you have. Please wait for it to finish.

Full permissions on critical DNN folders:

icacls "C:\inetpub\wwwroot\YourDNNSite\App_Data" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\YourDNNSite\Portals" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\YourDNNSite\DesktopModules" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\YourDNNSite\Images" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\YourDNNSite\Install" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T
icacls "C:\inetpub\wwwroot\YourDNNSite\Logs" /grant "IIS AppPool\YourAppPoolName:(OI)(CI)F" /T

Restart IIS:
iisreset /restart

5. Delete the problematic file (optional but recommended):

del "C:\inetpub\wwwroot\App_Data\Search\write.lock"

DNN will automatically recreate it with the correct permissions.

After following all the steps, my DNN Platform returned to normal.

I hope these steps help someone if have the same problem I did when using files from an external disk drive backup.

Regards,

Juan

Veteran Member
Posts: 363
Veteran Member
4 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
2 Avid Reader
Avid Reader
Avid Reader art thou!
2 Most Liked
Most Liked
Congrats, your posts are really liked!

Thank you for sharing!

These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved