We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Micorsoft.Web.Administration: Remote administration failure [Answered]RSS

6 replies

Last post Sep 15, 2017 08:56 PM by lextm

  • Micorsoft.Web.Administration: Remote administration failure

    Sep 14, 2017 09:15 PM|md2|LINK

    My test program try to list ApplicationPools from a remote system using Microsoft.Web.Administration( Version 10.0.0 on NuGet). Here is the code

    using (ServerManager serverManager = ServerManager.OpenRemote(ServerName))
    {
    	var appPools = serverManager.ApplicationPools;  //Assertion failure
    }
    

    Both the system are  2012 R2 . Firewall is disabled on both the systems. The logon user is domain\administrator.

    In debug mode, I can see the serverManager.ApplicationPools is not initialized correctly.  It is shown as below:

    ApplicationPools	'serverManager.ApplicationPools' threw an exception of type 'System.NullReferenceException'	Microsoft.Web.Administration.ApplicationPoolCollection {System.NullReferenceException}

    The  Assertion message is  "DCOM is unsupported". Here is part of the stack trace. 

     Microsoft.Web.Administration.ConfigurationManager.CreateWritableAdminManager(WebConfigurationMap webConfigMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)\r\n   at
     Microsoft.Web.Administration.ConfigurationManager.CreateConfiguration(WebConfigurationMap configMap, String configPathToEdit, Boolean isAdminConfig, Boolean isRedirectionConfig)\r\n   at
     Microsoft.Web.Administration.ConfigurationManager.GetConfiguration(String rawConfigurationPath, String cacheKey, Boolean isAdminConfig, Boolean isRedirectionConfig)\r\n   at
     Microsoft.Web.Administration.ConfigurationManager.GetApplicationHostConfiguration()\r\n   at Microsoft.Web.Administration.ServerManager.GetApplicationHostConfiguration()\r\n   at
     Microsoft.Web.Administration.ServerManager.ApplicationPoolsSectionCreator()\r\n   at Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)\r\n   at 
     Microsoft.Web.Administration.ServerManager.get_ApplicationPoolsSection()\r\n   at Microsoft.Web.Administration.ServerManager.ApplicationPoolCollectionCreator()\r\n   at 
     Microsoft.Web.Administration.Lazy.Initialize[T](T& target, CreateInstanceDelegate`1 valueFactory)\r\n   at Microsoft.Web.Administration.ServerManager.get_ApplicationPools()"

    Any hints to resolve it?

    Thanks

  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 03:32 AM|lextm|LINK

    You are supposed to use %windir%\system32\inetsrv\Microsoft.Web.Administration.dll.

    Lex Li
    Want to have a chat on the issues you meet? Find me at https://booktime.xyz/p/lextm
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 06:58 AM|Yuk Ding|LINK

    Hi md2,

    Just ensure that you have enough administration privilege to access the remote IIS. This link also provide some configuration to enable the DCOM:

    https://stackoverflow.com/questions/22458410/credentials-for-servermanager-openremote

    Best Regards,

    Yuk Ding

    Yuk Ding

    MSDN Community Support
    Please remember to "Mark as Answer" the responses that resolved your issue.
  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 04:45 PM|md2|LINK

    Thank you lextm, it worked.

    Please excuse my ignorance.  If the  program suppose to use %windir%\system32\inetsrv\Microsoft.Web.Administration.dll,    I wonder, when to use  the Nuget package? Also why  the Nuget file did not work?

  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 07:06 PM|lextm|LINK

    md2

    Please excuse my ignorance.  If the  program suppose to use %windir%\system32\inetsrv\Microsoft.Web.Administration.dll,    I wonder, when to use  the Nuget package?

    I think the NuGet package was only released for IIS Administration REST API,

    https://github.com/Microsoft/IIS.Administration

    Thus, the NuGet version is internally different from the version shipped with Windows.

    Lex Li
    Want to have a chat on the issues you meet? Find me at https://booktime.xyz/p/lextm
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 07:47 PM|md2|LINK

    Thanks lextm,

     The NuGet file worked for finding ApplicationPools  on local system, It failed when used for Remote systems.

    Do you mean  it is for administrating the local system only?

    -md2

  • Re: Micorsoft.Web.Administration: Remote administration failure

    Sep 15, 2017 08:56 PM|lextm|LINK

    md2

    Do you mean  it is for administrating the local system only?

    The REST API project is meant to manage local IIS only, so I think the design goal of the NuGet version Microsoft.Web.Administration might follow.

    Lex Li
    Want to have a chat on the issues you meet? Find me at https://booktime.xyz/p/lextm
    ---------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.