I was looking at this problem on SO; System.UnauthorizedAccessException: Retrieving the COM class factory for Word Interop fails with error 80070005.
We had word installed in the test server in order to get the Word Interop to work on it. That lead to this new bug, and I cannot apply the fix recommended by I cannot find Microsoft Word on the Componenet Services DCOM Config. So how can I fix this?
Change ownershipClick the Advanced button in the Permissions window and select the Owner tab. You'll notice the Trusted Installer as owner. Click the Change link (next to the current owner) to select the applicable owner (e.g. Local Administrators group) and click Apply, then OK.
To set access permissions for a computer On the Default Security property page in Dcomcnfg.exe, choose the Edit Default button in the Default Access Permissions area. To remove users or groups, select the user or group you want to remove and choose the Remove button.
Click on the Windows Start button, and select Run and then type “dcomcnfg” to open the DCOM configuration dialog box. Navigate inside the Console Root folder to the Component Services folder and then to the Computers folder.
Using the ERR tool we see the error: 80070005 is an Access Denied, so you either do not have permissions or its by-design.
for hex 0x80070005 / decimal -2147024891 :
COR_E_UNAUTHORIZEDACCESS corerror.h
MessageText:
Access is denied.
DIERR_OTHERAPPHASPRIO dinput.h
DIERR_READONLY dinput.h
DIERR_HANDLEEXISTS dinput.h
DSERR_ACCESSDENIED dsound.h
ecAccessDenied ec.h
ecPropSecurityViolation ec.h
MAPI_E_NO_ACCESS mapicode.h
STIERR_READONLY stierr.h
STIERR_NOTINITIALIZED stierr.h
E_ACCESSDENIED winerror.h
General access denied error
11 matches found for "0x80070005"
I mention by-design because of all the problems documented in this KB article: Considerations for server-side Automation of Office.
Installing Office on Server OS's leads to all sorts of problems. For VSTO development I install TFS on Win7 for automated builds to avoid server-side interop problems.
Dont use a Server OS for Office automation, as per the KB article its not supported, use Win7!
Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation. Before you involve Office as a server-side component in your project, consider alternatives.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With