Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Registry access error when Migrating ASP.NET application to IIS7

Tags:

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 to 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.

like image 463
Ben Anderson Avatar asked Jan 26 '10 21:01

Ben Anderson


1 Answers

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:

  1. Go to the Start menu in Windows 7.
  2. Type "Edit Users" in the search box.
  3. Open "Edit Local Users and Groups".
  4. Go to the groups folder.
  5. Right-click on the "Performance Monitor Users" group and go to properties.
  6. Click the Add... button.
  7. Type in "IIS APPPool\DefaultAppPool" and click Check Names.
  8. Click OK and you should be good to go.
like image 160
Ben Anderson Avatar answered Oct 04 '22 23:10

Ben Anderson