I spent several hours figuring this out. None of this helped me.
After analyzing the event logs on my IIS server, I found that every time I called the Start method on the ManagementEventWatcher object, I received the following error event in the syslog:
The default permission settings for the computer do not provide local activation permission for the COM server application with CLSID {49BD2028-1523-11D1-AD79-00C04FD8FDFF} and APPID {49BD2028-1523-11D1-AD79-00C04FD8FDFF} to IIS APPPOOL \ DefaultAppPool SID (S -1-5-82-3006700770-424185619-1745488364-794895919-4004696415) from the LocalHost address (using LRPC). This permission can be changed using the component services administration tool.
A search in the registry showed that the application with the APPID indicated in the error was
Unsecured Microsoft WBEM Apartment
To perform the asynchronous callback operation, you need to provide local activation permissions for this COM object for the IIS APPPOOL \ DefaultAppPool user, which sounds quite simple, except that the user does not appear as a valid security account for the database. This is because when you create an IIS application pool, an automatically created user account is automatically created.
The process for doing this work is as follows:
- Launch mmc, add the Component Services snap-in to
- Open Computers-> My Computer-> DCOM Configuration
- Scroll down to "Microsoft WBEM Unsecured Apartment Object"
- Right click and select Properties
- Go to the "Security" tab and in the "Launch and Activation Permissions" section, select the "Configure" option and click "Change"
- If your IIS server is part of a domain, make sure you have the local machine specified in the location field and not in the domain.
- Click the "Add" button and enter "IIS APPPool \ DefaultAppPool" in the user field and click the "Check Names" button. If you are not using DefaultAppPool, replace the name of the application pool that you are using.
- The current user will appear in the field, click OK.
- Select a user from the list and select the "Allow" checkboxes for local launch and local activation.
- Enjoy the fact that you will no longer see E_ACCESSDENIED for asynchronous callbacks to your WMI event listener.
source share