appcmd.exe RRS feed

  • Question

  • Thank in advance everyone.

    I have a problem I that I don't quite understand.  I wrote a small application in C#.net 4 (StopStartAppPool.exe) which I use in my TFS 2010 build process template (default template). The C# application calls the appcmd.exe to stop and start application pools. 

    On server 1, IIS compatibility is installed and everything works as expected.

    On servers 2, and 3, IIS compatibility is not installed, but the appcmd.exe does in fact exist in C:\Windows\System32\inetsrv.  Furthermore, on these two servers I can successfully use the appcmd.exe on the command line and via a .bat file using the usual syntax (C:\Windows\System32\inetsrv\appcmd stop apppool /apppool.name:AppPoolName), but when my build script runs --OR-- I try and run the StopStartAppPool.exe from the command line from my build server to stop the app pools on servers 2 or 3 I get these errors:

    The StopStartAppPool.exe encountered an error and exited with code Class not registered
    :     System.Collections.ListDictionaryInternal:     :        at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
       at System.DirectoryServices.DirectoryEntry.Bind()
       at System.DirectoryServices.DirectoryEntry.get_IsContainer()
       at System.DirectoryServices.DirectoryEntries.ChildEnumerator..ctor(DirectoryEntry container)
       at System.DirectoryServices.DirectoryEntries.GetEnumerator()
       at StopStartAppPool.StopStartAppPool.GetAppPoolState(String appPoolName, String targetMachine, ConnectionOptions connOptions, ManagementScope ms)
       at StopStartAppPool.StopStartAppPool.Main(String[] args):    

    All three servers are in the same domain.

    Given the info above it seems that the problem occurs when I try to access the appcmd functionality on servers 2 and 3 from a remote machine.

    Can someone help me understand why this is a problem?  I am going to try to get the IIS compatibility installed on servers 2 and 3, but there's a chance I may not be able to do so.  More importantly though, I'd really like to understand why this problem.

    Again, thanks in advance.


    Thursday, February 28, 2013 2:03 PM


All replies

  • Are all your servers in the same Domain?



    Friday, March 1, 2013 2:07 AM
  • Thanks chanmm.  I did verify that all systems are on the same domain.

    I am wondering if this has to do with the fact that IIS compatibility is not formally installed, even though the appcmd.exe does exist on all machines.

    Friday, March 1, 2013 12:13 PM
  • Hi Logan,

      Welcome to MSDN Forum Support.

      appcmd.exe is existance in all the windows system if you have installed your IIS.


    Some of the things you can do with AppCmd:

    • Create and configure sites, apps, application pools, and virtual directories
    • Start and stop sites, and recycle application pools
    • List running worker processes, and examine currently executing requests
    • Search, manipulate, export, and import IIS and ASP.NET configuration

    The detailed information about IIS, you can refer to this article named Getting Started with AppCmd.exe

    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Monday, March 4, 2013 7:21 AM
  • Thanks Jason.

    I have read a few articles on appcmd.exe and it does work as expected under some circumstances.  But those articles - including the one you mentioned have not to helped me understand why I'm having the problems on two of our three servers.

    Do you have any insight as to why I am getting those errors?


    Monday, March 4, 2013 12:41 PM
  • I was really hoping to get some more insight on this issue.  I'm willing to give any suggestion a try.


    Thursday, March 7, 2013 1:28 PM
  • Hi Logan,

      I feel that you wang to know how to extend the functionalities of IIS,so you need to study ISAPI Extensions. AFAIK, you can read the book named Professional Visual C++ Isapi Programming. But its knowledge points have outsided the forum support scope.

    Jason Wang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, March 8, 2013 7:39 AM
  • Jason,

    Thank you for the reply.  I'm not looking to extend IIS beyond it's default command line capabilities.  I'm just having trouble understanding why on one server, the C#.net application I wrote to execute the appcmd.exe works and on the other two servers it does not. 

    If there is a more appropriate place to post my question please let me know where this is and I'll move my question there. 

    Thank you again.


    Friday, March 8, 2013 12:35 PM
  • The answer was provided on another forum.


    Tuesday, March 12, 2013 5:33 PM