J
Jason Gleason
I am using the following method in a web service that utilizes the
system.directoryservices namespace:
[WebMethod]
public ArrayList GetAllAppPools(){
System.DirectoryServices.DirectoryEntry apppools = new
DirectoryEntry("IIS://webserver/W3SVC/AppPools");
ArrayList appPoolNames = new ArrayList();
foreach(DirectoryEntry de in apppools.Children)
{
appPoolNames.Add(de.Name);
}
return appPoolNames;
}
However, when i try to test the web service method, i get the following
error in the browser:
System.Runtime.InteropServices.COMException (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.ChildEnumerator..ctor(DirectoryEntry
container)
at System.DirectoryServices.DirectoryEntries.GetEnumerator()
at WebService1.Service1.GetAllAppPools() in
c:\inetpub\wwwroot\webservice1\service1.asmx.cs:line 86
We think it has something to do with security and ADSI, but we're not sure
how to fix it. Does anyone have any ideas? The code/dll works perfectly in a
windows form application. We will happily answer any further questions about
the problem. Thanks.
system.directoryservices namespace:
[WebMethod]
public ArrayList GetAllAppPools(){
System.DirectoryServices.DirectoryEntry apppools = new
DirectoryEntry("IIS://webserver/W3SVC/AppPools");
ArrayList appPoolNames = new ArrayList();
foreach(DirectoryEntry de in apppools.Children)
{
appPoolNames.Add(de.Name);
}
return appPoolNames;
}
However, when i try to test the web service method, i get the following
error in the browser:
System.Runtime.InteropServices.COMException (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.ChildEnumerator..ctor(DirectoryEntry
container)
at System.DirectoryServices.DirectoryEntries.GetEnumerator()
at WebService1.Service1.GetAllAppPools() in
c:\inetpub\wwwroot\webservice1\service1.asmx.cs:line 86
We think it has something to do with security and ADSI, but we're not sure
how to fix it. Does anyone have any ideas? The code/dll works perfectly in a
windows form application. We will happily answer any further questions about
the problem. Thanks.