Cannot read configuration file due to insufficient permissions ! [Web.config access issue]
Web.Config access issue can occur due to multiple reasons. First of all there is no problem with the config file so no change is required in the config file. The identity on which the web site’s application pool runs like LocalSystem, NetworkService etc should have sufficient permissions to access and read web.config file. For this directly go the website’s root folder and edit the security settings as per below steps- (If you already configured the permissions then skip to the second section)
(Steps are for adding permission for NetworkService Identity. Follow same steps for any other Identity your site’s application pool is running on)
- Go the site’s root\parent folder.
- Right click and select Properties.
- Go to the Security tab and click Edit.
- Click on Add. Select Users of Groups box will open.
- Computer name should be selected in the ‘From this Location‘ box. Now enter ‘Network Service’ in the ‘enter the object name’ box and click on check names. Click on OK.
- Now provide appropriate Read\Write\Full permission to the account and click Ok.
The access error should be resolved. If not, go to the site’s path in InetMgr (IIS Manager) and open the authentication settings as below-
Go to Anonymous Authentication and Click on Edit. Now select ‘Application Pool Identity’ and click on Ok.
Note: The above steps shown should be done as per the Identity your site’s application pool is running on.
Error due to Rewrite Module not installed but used in the web.config file.
If still the same error comes then probably there is nothing wrong with access permission but your web.config has <rewrite> section defined but the Rewrite module isn’t installed on your IIS. This can be frustrating as IIS does not show anything related in the error message. In such case, install the rewrite module by downloading from this link and enable it.
Hoping the above solutions would resolve the error. If not please comment on the post and we can look into it.
Thanks for checking out !