DirectoryEntry.NativeObject throws access denied for a user in Administrators group in windows 2008
问题 I have a local user, which is member of Administrators local group. When I run this code: using System; using System.DirectoryServices; namespace nanttest { class Program { public static void Main(string[] args) { using(DirectoryEntry entry = new DirectoryEntry("IIS://localhost/W3SVC")) { object absobject = entry.NativeObject; Console.WriteLine("Name: {0}", entry.Name); } Console.Write("Press any key to continue . . . "); Console.ReadKey(true); } } } I receive: Unhandled Exception: System