2

I need to access to a distant iis on a remote machine, It actually work fine when I tried to access to it giving an ip+port to my local machine in the browser and iis seems work fine and I can control it with the iis Manager interface.

iis remotely access from my local machine

Ican access to the distant web site

My problem is when I need to use this code (I've already test it and it works perfectly as a localhost) my code threw me this exception :

System.UnauthorizedAccessException: 'Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine RD01 failed due to the following error: 80070005 RD01.'

When I try to debug what the ServerManager return it show me this:

'serverManager.ApplicationDefaults' threw an exception of type 'System.UnauthorizedAccessException'

Note: I've already tried this solution mentioned in the following link, but it does not work

Credentials for ServerManager.OpenRemote

UPDATE

I forgot to mention that I work with Microsoft.Web.Administration.dll v 7.0.0 and my application is a desktop app with WPF

AMLOCO
  • 41
  • 6
  • That remote API is designed for intranet and requires DCOM ports to be opened and accessible. Please use the new IIS REST API as that covers more scenarios and simpler to use. – Lex Li Aug 23 '19 at 14:14

1 Answers1

0

try to follow the below steps:

1)open search from your machine and type DCOMCNFG.

2)In the component service window right-click on the My Computer and select properties. Choose the COM Securities tab.

2)In Access Permissions, click Edit Defaults and add Network Service to it and give it Allow local access permission. Do the same for < Machine_name >\Users or iis_iusrs, iusr.

3)In Launch and Activation Permissions, click Edit Defaults and add Network Service to it and give it Local Launch and Local Activation permission. Do the same for < Machine_name >\Users ,iis_iusrs, iusr.

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26
  • I did all that but I still get the same exception – AMLOCO Aug 27 '19 at 13:52
  • try to change the AppID Registry key under HKEY_CLASSES_ROOT\AppID\WINWORD.EXE from old entry to {00020906-0000-0000-C000-000000000046}. refer this link for more detail. – Jalpa Panchal Aug 29 '19 at 09:42
  • Unfortunately, this is still not working, while debugging I get error in this line: var serverManager = ServerManager.OpenRemote("RD01"); Is there any specific permissions to grant to visual studio ? (I already ran it as an administrator) – AMLOCO Aug 29 '19 at 16:24
  • did you restart the machine after doing registry changes? – Jalpa Panchal Aug 30 '19 at 08:50