Cannot read configuration file due to insufficient permissions - asp.net

Okay, I realize there are many questions relating to this error, I have read several questions and answers without resolving my problem.
I have a MVC site that I'm trying to debug on local IIS web server.
I check the option to use local IIS in the project properties and I've created a virtual directory in IIS.
The error I get in Visual Studio is:
Unable to start debugging on web server.
In IIS i try browse the site but get the error:
Cannot read configuration file due to insufficient permissions
Config File \?\C:\Users\Mike\Documents\Visual Studio 2010\Projects\MvcApplication1\MvcApplication1\web.config
I've set permissions for the pool identity on the web.config and whole project folder.
I've tried localsystem identity, no luck!
Please help me resolve this. I've spent several hours trying to fix this.

I found that if granting read permission to IIS_IUSRS still does not help. You need to also check that the web.config file is not encrypted. You can see if the file name is green in Window Explorer, it means the file encrypted. You can also do right click at the file, select Properties… / General Tab / Advanced… Make sure the "Encrypt content to secure data" unchecked.
It works for me once I uncheck that Encrypt box.

Maybe this will help. Look here, here and here
You also might have to grant ISS_IUSRS right to C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config and then do a iisreset
Edit:
Do you have the right Application Pool Identities? Read more here

For local development I've used pritty straightforward solution - just set IIS Application Pool to LocalSystem, set permissions for site folder (ISS_IUSRS - all) and it's worked for me

I only ran into a different set of issues with IIS_IUSRS. So I just published the site under a whole different folder, off the root, and the issue went away!

Related

Web.Config - Cannot read configuration file due to insufficient permissions

I am getting the error:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070005
Config Error Cannot read configuration file due to insufficient permissions
Config File \\?\C:\inetpub\wwwroot\web.config
The file itself has full permissions for IUSR. IIS is running its app pool under ApplicationPoolIdentity. I did a file monitor on the file, and I see this:
9:04:43.8035456 AM w3wp.exe 8104 CreateFile C:\inetpub\wwwroot\Web.config ACCESS DENIED Desired Access: Generic Read, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: N, ShareMode: Read, AllocationSize: n/a
No idea why I am getting this error... Any ideas?
Try giving read/write access to these accounts to the root folder of your Web application and all files/subs within:
NETWORK, NETWORK SERVICE, and of course IIS_IUSRS
I found that adding the mymachine/USERS with full permissions to C:\inetpub\wwwroot fixed the issue.
The problem was caused because I shared some sites content inside C:\inetpub\wwwroot with other developers. This must have changed permissions and broke my IIS completely.
First, make sure IUSR has Read permission on the config file (which I believe you have done that)
Then, change IIS authentication method to BasicAuthentication
If still not working, probably the .config extension is not properly installed in IIS.
Try all 3! Good luck!
EDIT: Forget to ask you, what kind of appliation is it?
I just came across this and was unable to find applicationpoolidentity as an account in order to add it to the folder security. I changed the application pool identity from applicationpoolidentity to Local Service and the site ran fine.
I was copying a live WordPress site to my local machine for editing/updating when this IIS error occurred. Changing permissions did nothing.
In my case, simply deleting the web.config did the trick.
I ran into this issue again today. This time, no amount of granting permissions worked (tried all the usual accounts, everybody, read-only, modify, full control).
Closed processes, restarted IIS, full reboot. No results.
Eventually changed the owner from "Administrators" to myself, and things fell into place.
I usually run Visual Studio at Admin level (using my own account) because I like to use the local IIS for hosting / debugging ASP.NET sites. Perhaps that caused new files to be owned by \Administrators, which in turn may have limited access to those files by the IIS or App Pool processes.
My DefaultAppPool identity is set to load the user profile. I don't know at what point the session manager applies UAC / permissions drops and whether user profile loading has any influence on this. Food for thought...

Hosting ASP.NET in IIS7 gives Access is denied?

I have setup a application in my IIS7 that uses .NET Framework 4.0 (runned by NetworkService) but when browsing the site I get this:
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. You might not have permission to view the requested resources.
Error message 401.3: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to*
I have tried to give NetworkService full permission on the folder that holds the website (the one that the web application in IIS is pointing against) but I do still get the access denied?
Why?
I gave access to "IIS_IUser" but instead it should be "IUSR". That solved the problem.
For me, nothing worked except the following, which solved the problem: open IIS, select the site, open Authentication (in the IIS section), right click Anonymous Authentication and select Edit, select Application Pool Identity.
I had the same problem, I enabled "Anonymous Authentication" but it still did not work.
So I also ENABLED "Forms Authentication" Then it worked without any problems.
OS : Windows 7 & IIS 7
If you still have permission denied after adding IUSR & NETWORK SERVICE.
Add also IIS_WPG. The addition of this last user solved my problem.
For people who can't find those users:
when you're trying to add a user in security of the folder (properties of the folder), click on "Advanced" of the window "Select Users or Groups". Change the location to the computer name then click on "Find Now". You'll find those users in the list below.
If you're using Anonymous Authentication, IIS 7 will use the "IUSR" account for directory access (unless you've set it to use the app pool identity. If you haven't granted IUSR sufficient permissions on your site's folders and files, you'll get this error
For me in windows 7 it started to work only after I gave 'Read & execute', 'List folder contents', 'Read' permissions to site folder for both users
IUSR
NETWORK SERVICE
Tried most of the solutions here, but no luck. What worked for me was adding "Everyone" to the security permissions. Properties -> Security -> Edit -> Add -> Everyone. The given defaults were enough for me to regain access.
In the near future, I should probably figure out what credentials are being sent to the server so that I can give proper permissions. But I hope it helps someone!
In the Authentication settings for APP itself (IN IIS), see if you have anonymous enabled.
We need to create a new user ComputerName\IUSR by going to the website folder-->Properties--->Security--->Edit-->Add and give read access. This would work definitely.
This solution is for IIS7
I went round and round on this and it turned out to be improperly set default page. Hope this helps someone else avoid an hour of wasted time.
In my case running c:\windows\Microsoft.Net\Framework64\v4.0.30319\aspnet_regiis.exe /i resolved the 403 access denied issue.
Checking the Application Pool Identity in Anonymous Authentication and enabling Forms Authentication would solve problem for access denied error. 😁
After some thinking and a lot of of trial and error I found out that this error occurred because part of my web.config was encrypted and for some reason the key was no longer valid.
Re-encrypting the config section solved the issue.
After watching this tutorial :
https://www.youtube.com/watch?v=RbrZbHpXBTE&list=PLp1Emx1rT4z9YWLDXBjUwBb130qv2Zq2x&index=4&ab_channel=LearningProgrammingTutorial
I had the same problem using RDP ( windows server 2016 Datacenter )
i followed the tutorial above & enbaled my directory browsing options from the IIS internet infromation services manager.
what you want to do is to access your IIS manager , you can check out the tutorial above to learn how to access IIS manager if you have trouble acessing there , it was useful for me that's why I'm sharing then ... go to :
you should gave access to IUSER
( or application tool identity , depends or what you want to work with )
and your problem would be solved! :)
Also you need to check your firewall and TCP settings , if ping between two machines didn't work for you , you can check this out :
https://operavps.com/rdp-connection-issues/
It was due to WWWRoot directory security issue.
Simple solution is, Just copy applicatio folder to some other drive, Instead of "C:\Inetpub\wwwroot"
and then create a virtual directory for this new path. That's it.
If the IUSR user is already specified in Authentication and you're still getting this issue, it could be that your Directory Listing isn't enabled. Be sure to check that. That was the case for me.
This is what happened to me:
Get - Post is ok. Working well.
When I try to use Options verb, the server return error like that.
Then, beware with urlScan
I add OPTIONS verb to urlscan configuration .ini file, then everything works well.
To check if urlscan is installed or not, open your iis manager, and open ISAPI FILTERS url scan should appear at the list.
I was also facing the same issue,
Everything was normal all the rights were given to the user and for folder as well.
After many research i found that the wwwroot (Source code folder) was shared with some other user.
I stopped sharing and it worked like a charm.
I was facing this issue after pulling from remote master and adding to the appsettings on web.config.
I solved it by enabling Windows Authentication:
Click on the project and press f4
Make sure Windows Auth is enabled:

Cannot log on locally IIS [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
What causes this error, how can I fix it?
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x8007052e
Config Error Can not log on locally to C:\inetpub\wwwroot as user administrator with virtual directory password
Config File Unavailable (Config Isolation)
Requested URL http://192.168.0.3:80/
Physical Path C:\inetpub\wwwroot
Logon Method Not yet determined
Logon User Not yet determined
Config Source
<application path="/" applicationPool="PS-Extranet">
<virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" userName="administrator" password="[enc:AesProvider:PrISRz2ggJH4bV46ktObfCSh91Y/yF9pAoLmH7eCnj0=:enc]" />
</application>
I had the same issue, but reason was different.
In my web.config there was a URL rewrite module rule and I haven’t installed URL rewrite module also. After I install url rewrite module this problem solved.
Looks like the user account you're using for your app pool doesn't have rights to the web site directory, so it can't read config from there. Check the app pool and see what user it is configured to run as. Check the directory and see if that user has appropriate rights to it. While you're at it, check the event log and see if IIS logged any more detailed diagnostic information there.
On Windows 10 I had to install ASP.NET 3.5 and ASP.NET 4.6 under Internet Information Services (the other boxes automatically check themselves):
Finally I get the solution for my problem. The asp.net account not appear in the IIS manager because I didn't check its check Box in IIS to do this in windows 7 follow the steps
Open control panel
Click on” program” link (not uninstall programs)
Click” turn windows features on/off” link
locate” Internet Information services IIS” in the pop up window and expand its node
Expand the” World Wide Web Service” node
Expand “Application Development Features” node
check the check box of”ASP.NET”
Then click ok button
Now you will see the Asp.net account on the IIS manager and by default you see IIS account Now you should move you asp.net website from “my document” to another place the IIS have permission to access it (to any partition on your computer) Now browse your website from IIS manager and it should work.
We got this error after having to change our domain administrator password.
After monkeying with several settings, I eventually found that in the application in below path as it was set to specifically use the domain administrator account rather than pass-through authentication (who knows why).
IIS Manager -> Basic Settings -> Connect
you need to do one step:
run->cmd
run "c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i"
Thats it
Experienced this issue today and resolved it. Someone had set the "Path Credentials" for the "Default web site" in IIS to run as a specific user. This same user changed her password either due to the password expiring or just a routine change. Setting the "Default website" to connect as the "Application User" via the basic settings option resolved it for me
you probably change your NT password.
Open IIS -> Right click on your application -> manage application -> advanced Setting -> physical path credentials.
good luck
In my case, this error appears after changing folder's solution.
I solve the problem by goin to my project properties and recreate my virtual directory.
Right click on project > Properties > Web > Under Servers section click "Create Virtual Directory"
It will display a message saying that the virtual directory was created in another place and it will change it
For me, I needed to enable Http Activation under the .Net features in "Add/Remove Windows Features"
Got this working alright but not based on suggestions above. My case is that am getting the 500 error running iis7 on a windows 2008 server in a domain. Just added a new user in the domain and basically allow read/execute access to the virtual directory or folder. Ensure that the virtual folder>basic settings> Connect As > Path credentials is set to a user with read/xecute access. You can test settings and both authentication and authorization should work. Cheers!
Default web site need to manage as well:
1 .On Default web site -> basicSettings -> connect as, change it to the right user.
2.change the Identiy of the applicationPool that related to the defaultWebSite
g.luck
Right now i had this error and resolved it. Your url could match with created virtual directory.
You have to check virtual directories, in my example i found in applicationhost.config next row:
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/admin/roles" physicalPath="C:\..." />
</application>
I tried to open page with an url (http://localhost/admin/roles) of AdminController and Roles action and got this error.
For others out there, I got a similar error message due to trying to run a .Net 4 app in a .Net 2 app pool. Changing the .Net FX version for the app pool fixed it for me.
I was having a similar error installing php 5.3.3 with the Error Code 0x80070020 with a direction to a few lines in web.config in my www root directory (not the standard root directory).
The solution, while crude, worked perfectly. I simply deleted the web.config file and now everything works. I spent HOURS trying other solutions to no avail.
If anyone thinks this was stupid, please let me know. If anyone else has spent the same amount of time pulling out hair, try it and see (after backing up the file of course)
Regards FEQ
Was having the same error and fixing the credentials in the IIS app pool did not help. I finally resolved the error in IIS by selecting my website under Default Web Site, Advanced Settings->Physical Path Credentials->Specific User, and reentered the credentials for the app pool user, then restarted IIS and the error went away and my website came up successfully.
As I got the 500.19, I gave IIS_IUSRS full access rights for the mentioned web.config and for the folder of the project. This solved the issue.
You can give permissions by
right click on the folder / file
selecting the tab "security"
add the user IIS_IUSRS - don't forget the i in front of USRS and don't write an "e" as in USERS
If it's bigin when you try to acces to joomla administrator panel, Just a username and password problem !! You have just to update a jos_user in your joomla database.
Go to your joomla web site directory and open a configuration.php with bloc note or note pad to show what database name your joomla administrator site use.
You have to find a line who have:
public $user = 'joomlauser251'; //MySQL username
In my case joomlauser251 is my DB name.
Login to your mysql:
mysql -uyourusername -pyourpassword
Select database for your joomla:
use joomlauser251;
Change password for admin:
UPDATE jos_users SET password=MD5(‘NewPassword’) WHERE username=’admin’;
And retry to acces again.
That’s all !!!
Didn't seem to be a permission issue for me - tried giving the IIS_IUSRS account full control over everything in the web service, just to see if this was the cause. The fix turned out to be recreating the application hosting the web service (i.e. the actual '.svc') in IIS
In my case, I found a reference to an old domain account password in applicationHost.config under Virtual Directory defaults.
so easy
find the file "applicationHost.config" in Windows -> System32 ->inetsrv -> config
1. backup "applicationHost.config" to another filename
2. open file "applicationHost.config" clear data and save
3. open browser and call url internal website , finished.
If you are using a new, dedicated, user account... It is also worth checking that the password for that account has not expired, as that will also cause this 500.19 permissions issue.
For ASP.NET Core websites, this generic error will also occur if you don't have the HttpPlatformHandler module installed, see this answer for more details.
ASP.Net applications come pre-wired with a handlers section in the web.config. By default, this is set to readonly within feature delegation within IIS. Take a look in IIS Manager
1.Go to IIS Manager and click Server Name
2.Go to the section Management and click Feature Delegation.
3.Select the Handler Mappings which is supposed to set as readonly.
4.Change the value to read/write and now you can get resolved the issue
I have just one more thing to say about this. With the same HTTP Error code, you can still have several different errors, as one of them has been posted here at the original question's description.
For example: after I've edited the Web.Config file of an ASP.NET project, I had
Error Code 0x8007000d
"Only one <configSections> element allowed. It must be the first child element of the root <configuration> element "
As it says, you must NOT insert your own XML stuff before the <configSections> part of the Web.Config file. After I've inserted my snippet after the end tag of <configSections>, it worked just fine.
My website's correct path was not specified in IIS.
My solution is that,
just delete the corrupted folder.
Then re-create folder again.
It seem that if the corrupted folder had been created before IIS
setup. If you created folder again, it will work correctly.
I got this error after uninstalling Windows Server Update Services (WSUS) from the computer running IIS. Apparently uninstalling WSUS may break the IIS configuration on the server making other web application installed on the same server unavailable.
I found the solution for the problem here.
In my case, the value of the Key was incorrect in Web.config file:
<defaultDocument>
<files>
<add value="Portal.htm" />
</files>
</defaultDocument>
when I change the value to "Portal.html" it worked.
I got this error after upgrading from Visual Studio 2013 to 2015. After a bit of searching and trying various fixes I found the problem can be resolved by removing the following from web.config:
<staticContent>
<mimeMap fileExtension=".less" mimeType="text/css" />
</staticContent >
Apparently staticContent is deprecated now?
Source
Edit 1
This sort of prevented IIS from serving .json files when the program was deployed. If you do this you're supposed to re-add .json (application/json) to the mime types of your site in IIS. Here is some more info: http://www.iis.net/configreference/system.webserver/staticcontent/mimemap
Edit 2
I noticed that in my situation the above edit 1 solution only works temporarily. Once I redeploy the entry gets removed. So, I moved the mimeMap XML into Web.Release.config. Works fine now.

Quick Question About IIS 7 Asp.Net Setup

I have been trying to configure a small website on a Windows Server 2008 running IIS 7. Unfortunately, when trying to load the website I keep getting the error: Server Error 401 - Unauthorized: Access is denied due to invalid credentials.
The permissions on the website folder include read, write, and execute for user ASP.NET v4.0. I even clicked "Check names" before adding the user to folder, to make sure that I spelled everything correctly. But the error continues to show. Also, I noticed that everything works okay if I add "Users" to the permissions for the folders containing the website, but I don't see why this should be necessary. I only want to give ASP.NET v4.0 access to the folder.
Some other noteworthy points include that I'm using the ASP.NET v4.0 application pool, that the managed pipeline is integrated, and that load user profile is set to true.
If anyone has any ideas, I'd appreciated the help. I'm stumped!
EDIT: Does it matter that the website is on the d: drive? I just assumed this wasn't important...
I find I always need to give IIS_IUSRS access.
I'd recommend you to use the Process Monitor to detect which user is actually accessing the file.
Here you'll find an explanation about how to achieve that.
Open IIS7 on the server. Highlight the site, and double-click on the Authentication icon in the Security Section. Check that Anonymous Authentication is enabled.
Some troubleshooting links for this particular issue:
http://support.microsoft.com/kb/902160
http://support.microsoft.com/kb/907273

Handler not yet determined error

I don’t know anything about deploying a website, so I probably made some stupid mistake.
Anyways, I opened IIS 7 manager, created new virtual directory ( via Add Application ) and pointed it to physical directory where Visual studio saved my Web project. But when I tried to request an .aspx page, browser reported the following error (I won’t post the whole error, but just the interesting bits):
Handler: Not yet determined
Config Error: Cannot read configuration file due to insufficient permissions
Logon User: Not yet determined
A) why is handler not yet determined? As far as I know, IIS7 does have Asp.Net handler registered?!
B) Why wouldn’t IIS have sufficient permissions? Does that mean I should give IIS higher privileges? Or does Asp.Net runtime have insufficient permissions?
C) Could the error also be due to the fact that perhaps it expected the user to authenticate itself? I’m assuming this due to Logon user not yet being determined?
D) And finally, any ideas how to make it work?
thanx
error code:0x8007000d
I started playing with permissions and all the stuff about access issues to web.config or applicationhost.config anyway those did not change the error.
while I was playing with my web.config I deleted rewrite tags from my config file and error changed. then I installed "web platform installer" and installed url rewrite module for IIS and played with some configuration now my site is working. it took about one day to find out this issue I hope it helps someone.
Does the identity of your IIS application pool have sufficient rights to access the folder that is hosting your site?

Resources