First of all check the requirements: DNN Platform Requirements -- DNN Docs (dnncommunity.org) - regarding SQL Server, this is not valid anymore, it must be at least 2016 (even if this version is out of mainstream support already, so better take 2019 or 2022). Regarding .Net I would recommend to use version 4.8.1.
Then:
Please (double) check if the AppPoolIdentity is selected as the anonymous user identity - open IIS Manager, select the site, double click "Authentication" in the IIS section, select "Anonymous Authentication" and click "Edit..." on the right side. Make sure the option "Application pool identity" is the selected option. To be sure, select the Application Pool, open "Advanced settings..." and check if "ApplicationPoolIdentity" is selected as Identity in the Process Model section. Also check if the selected .Net CLR version is set to v4.0, and the managed pipeline mode is set to "Integrated".
Also (double) check in the Windows Explorer if the application pool identity has Modify permissions in the complete tree starting from the web root. Sometimes I disabled inheritance from the root folder, selecting "Convert inherited permissions into explicit permissions on this object", and the re-enabled inheritance, and then it worked.
Then (double) check in SQL Server Management Studio (SSMS) if the application pool is in the db_owner database role for the database. Start SSMS, open the "Security" and then "Logins" node on the left, right click the Application Pool login, select "Properties", select "User Mapping", select the database in the upper half of the dialog and check if "db_owner" is selected in the lower part of the dialog.
If all of this is done, then the thing should work.
Happy DNNing!
Michael