Http Client Protocol Issues

If you use any of these solutions, Please let me know so I can track if any of this is useful to you! Thanks! This is an area to share observations I have made working with Http Client Protocols and the associated technologies. I currently work for the Microsoft team that supports the WinInet, WinHTTP and System.Net API's and classes associated with these technologies. This is not a replacement for Microsoft Support, but an area to discuss these technologies. These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified at Microsoft - Information on Terms of Use

IIS 7 ADSI Error: System.Runtime.InteropServices.COMException (0x80005000): Unknown error (0x80005000)

The following code worked fine on IIS 6 but when used on IIS it failed:

System.DirectoryServices.DirectoryEntry iisServer;
iisServer =
new System.DirectoryServices.DirectoryEntry("IIS://jsanders4/W3SVC/1");
System.DirectoryServices.
DirectoryEntry rootFolder = iisServer.Children.Find("Root", "IIsWebVirtualDir"); //exception here

The exception was as follows: 

[System.Runtime.InteropServices.COMException] {"Unknown error (0x80005000)"} 
System.Runtime.InteropServices.COMException

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.CheckIsContainer()
   at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaC
lassName) 

 

The error code is not translated to anything.  This indicates that the ADSI provider for IIS://jsanders4/W3SVC/1 does not exist or it is inaccessible.

Opening up IIS manager you can see that the webserver 'jsanders4' is up and running and the primary website ID is indeed 1.  The logical conclusion then is that the ADSI provider for IIS://jsanders4 must be the problem.

IIS 7 does not install an ADSI provider by default.  You can enable it however as a Role Service for the IIS Web Server.  You need to enable the IIS 6 Metabase Compatiblity role service.  Probably a better way to proceed is to change your code to use the WMI provider for IIS 7 http://msdn.microsoft.com/en-us/library/aa347459.aspx

After installing the IIS 6 Metabase Compatiblity role service the error changed:     

[System.Runtime.InteropServices.COMException] {"Access is denied.\r\n"} System.Runtime.InteropServices.COMException
ErrorCode 0x80070005

Access is denied.

   at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
   at System.DirectoryServices.DirectoryEntry.Bind()
   at System.DirectoryServices.DirectoryEntry.get_IsContainer()
   at System.DirectoryServices.DirectoryEntries.CheckIsContainer()
   at System.DirectoryServices.DirectoryEntries.Find(String name, String schemaClassName)

This is because Windows Server 2008 is locked down with UAC.  You need to run the program as Administrator to execute this program. Another alternative is to set the account that is running this program with the rights: Logon as a Service"/ "Logon as a Batch Job"

I hope this helps you!  Let me know if you used it to solve an issue.

Published Wednesday, May 13, 2009 10:12 AM by jpsanders
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Antonio Bakula said:

Thanks, this helped me to install Embarcadero "Performance center" on Windows 7 RC

September 11, 2009 6:19 AM
 

David Mertz said:

Thanks, this helped.  This seems like a good excuse to learn WMI, since we don't want to turn compatability on unless we have to.  I do wish the code would throw something more descriptive than "Unknown error", though.

November 2, 2009 9:09 AM

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Submit

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker