Registry access error when Migrating ASP.NET application to IIS7
I'm running windows 7 64-bit and iis7. I'm trying to setup a web application that was previously in iis6 on XP. It's giving me the error below. I've added the network service user to the Performance Monitor Users group to no avail.
Access to the registry key 'Global' is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.UnauthorizedAccessException: Access to the registry key 'Global' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access t开发者_StackOverflow中文版o a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
The problem is that user in Windows is known as DefaultAppPool. However he doesn't show up anywhere in the security dialogs. He is an actual user though. My problem was I needed that user to be part of the PerformanceMonitorUsers group because my web service was using PerformanceCounters. Turns out you have to do it from the command line.
net localgroup "Performance Monitor Users" DefaultAppPool /add
Occasionally that does not work and it will give you the error: "There is no such user or group: DefaultAppPool"
To add the user a different way:
- Go to the Start menu in Windows 7.
- Type "Edit Users" in the search box.
- Open "Edit Local Users and Groups".
- Go to the groups folder.
- Right-click on the "Performance Monitor Users" group and go to properties.
- Click the Add... button.
- Type in "IIS APPPool\DefaultAppPool" and click Check Names.
- Click OK and you should be good to go.
Use net localgroup "Performance Monitor Users" "IIS AppPool\DefaultAppPool" /add
I had the same issue and I made the same setting as discussed above but it didn't work for me. The changes which worked is
- Go to IIS (inetmgr.exe).
- Check your application AppPool advanced settings.
- Managed PipeLine mode should be Integrated.
- Process model identity should be Network Service.
This worked in my case. May be this will help you if above setting is not working.
My thanks to Fande455
I had this issue after migrating my web Apps. I do indeed reference performance counters in my app and sure enough I suffered this problem. To me this was a normal issue and on IIS6, and IIS7 on windows 7 adding the usual IIS users to the Performance Monitor Users group solves the problem. However on Windows server 2008 running IIS7 this was not the case and this post did indeed save the day.
Many thanks, I updated my original post Here
Basically you need to follow the instructions, but look at the configuration of your Application Pool, you will want to find the executing user account, and grant that user access to the proper permissions.
Just to add to this answer I have found on several occasions that I've had to restart the entire server for the change to take effect, restarting just the Web Publishing Service has been insufficient. If anyone knows the right combination of services to restart please add an answer. :)
精彩评论