I did the following steps:
-
Reinstall Windows server 2008 R2 SP1
-
Install iis
-
Install VS 2022 17.1.4 and created new ASP.Net core app (with standard template) and publish
But when I tried to open the site I got an error
500 – internal server error.
When I tried to double click on the "Error pages .NET" icon in IIS manager, I got an error on reading of
File: ?D:monitor22web.config
Access to the folder " ?D:monitor22" and pool credentials is made from administrator. How I can solve the problem?
2
Answers
There is no problem with web.config file. you just need to give permission to read of file to IIS Users
For reference check following link Cannot read configuration file due to insufficient permissions
check it and if this not okay to solve your problem then there is may be change in application pool.
For that,
For Reference check the following link https://success.trendmicro.com/dcx/s/solution/1098768-cannot-read-configuration-file-appears-on-http-error-500-19-when-accessing-the-worry-free-busin?language=en_US
Hope this will help you. The first option was helped for me when I stuck in same issue.
First, ensure that the ASP.NET Core application’s application pool is configured to run under an account with sufficient permissions to access the application directory.
Open IIS Manager >> Select the application pool used by your site >> Click "Advanced Settings" in the Actions pane on the right >> Check "Identity" under the "Process Model" section. By default it is set to "ApplicationPoolIdentity", which should be the recommended setting.
Then you need to grant Read permission to the IIS_IUSRS group for the Web.config file indicated in the error message. Even if there is no config file at that location, the IIS_IUSRS group needs at least Read access to the directory so that it can check for a web.config file in that directory. (ApplicationPoolIdentity is the member of the IIS_IUSRS user group, it does not refer to a user, but a collective name for all program pool default identification users.)
Right click on the "D:monitor22" folder >> Select "Properties" >> Go to the "Security" tab >> Click "Edit" to adjust the permissions >> Add IIS_IUSRS with at least "Read" and "Execute" permissions.
If you have manually changed the application pool identity to a specific user account, make sure that account has read permissions to the directory where the web.config file is located.