Got this funny little thing today when I was trying to enumerate children of a Directory Entry:.
System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000) 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 Program.Program.Main(String args)
Very helpful error message : “Unknown error (0x80005000)”, search on google didn’t turn up anything useful at first glance, something about primary tokens in asp.net and something about this popping up when people were doing LDAP stuff.. neither helped me much.
The error was occuring when I defined my DirectoryEntry so after a short code review I found the issue. I was calling :
DirectoryEntry AppPoolRoot = new DirectoryEntry("IIS://Localhost/W3SVC/AppPools/");
When I should have been doing this.
DirectoryEntry AppPoolRoot = new DirectoryEntry("IIS://Localhost/W3SVC/AppPools");
Notice the trailing slash, that little bugger was causing this error. So make sure you are using the correct path if you run into this.
Jóhannes H. Laxdal is a specialized humanoid carbon unit whose field is computers and telling lousy jokes, it has a tendency to put "well" before every sentence it utters. In here you will find its ramblings about computer-related stuff.
Tags.net 7 8 2008 2008 R2 Administrator Administrator for web ADSI Application Pool AppPool asp.net backup BannerBitmap C# CentOS CIDR Create debian Decimal Dedicated Server Enumerate Enumerate Websites error IE 7 IIS IIS 6 install banner L4D2 Left 4 dead 2 Linux PeriodicRestartSchedule php Recycle Recycling Samba script spam Submask user-agent Website windows Windows 7 Windows 2008 R2 Windows Media Services WMS