Home>

First, the error situation

Environment:win7 + iis7.0

Directoryentry configuration iis7 gives the following error

or

The following code works fine under iis6.0,But it will run wrong under iis7.0:

system.directoryservices.directoryentry iisserver;
iisserver=new system.directoryservices.directoryentry ("iis://localhost/w3svc/1");
system.directoryservices.directoryentry rootfolder=iisserver.children.find ("root", "iiswebvirtualdir");//An exception is thrown here

The exception is 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 schemaclassname)

Error analysis

This exception code indicates that the adsi provider of iis://localhost/w3svc/1 does not exist or cannot be accessed.

Open the iis manager and you can see that the server's localhost (the default site) exists and is running.And the primary site id is indeed 1. This indicates that the problem is with the adsi provider at iis://localhost.

Third, the cause of the error

Win7 uses iis7, and iis 7 does not install adsi provider by default.

Fourth, the solution

To solve this problem, install "iis metabase and iis 6 configuration compatibility".

"Control Panel"->"Programs and Features"->"Open or Close Windows Features" on the left side of the panel->"Internet Information Services"->"Web Management Tools"->"IIS 6 Management Compatibility "->" Iis metabase and iis 6 configuration compatibility ".

As shown below:

5. What should I do if this error occurs in windows server 2008?

In Windows Server 2008, after installing the "iis metabase and iis 6 configuration compatibility" using the role service, the following errors may also occur:

[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 by uac (user account control). You need to execute this program with an administrator account. Another way is to set the account running this program to have the following permissions:logon as a service "/" logon as a batch job "

c
  • Previous Java multi-threaded implementation of asynchronous calling method
  • Next How to solve slow mysql database connection in LAN