473,692 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

web service system.director yservices call access denied

I am using the following method in a web service that utilizes the
system.director yservices namespace:
[WebMethod]
public ArrayList GetAllAppPools( ){
System.Director yServices.Direc toryEntry apppools = new
DirectoryEntry( "IIS://webserver/W3SVC/AppPools");
ArrayList appPoolNames = new ArrayList();
foreach(Directo ryEntry de in apppools.Childr en)
{
appPoolNames.Ad d(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.Director yServices.Direc toryEntry.Bind( Boolean throwIfFail)
at System.Director yServices.Direc toryEntry.Bind( )
at System.Director yServices.Direc toryEntry.get_I sContainer()
at System.Director yServices.Child Enumerator..cto r(DirectoryEntr y
container)
at System.Director yServices.Direc toryEntries.Get Enumerator()
at WebService1.Ser vice1.GetAllApp Pools() in
c:\inetpub\wwwr oot\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.


Nov 16 '05 #1
1 7374
Jason,

You are right. By default, ASP.NET runs under the ASPNET local user
account, which has limited rights. Chances are your AD controller isn't set
up to allow access by that user (it doesn't have rights to the network
either).

To get around this, use the overload of the DirectoryEntry constructor
which takes a username and password as well, passing the username and
password of an account that has the appropriate rights to access the AD
controller.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Jason Gleason" <ja***********@ gensurvey.com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
I am using the following method in a web service that utilizes the
system.director yservices namespace:
[WebMethod]
public ArrayList GetAllAppPools( ){
System.Director yServices.Direc toryEntry apppools = new
DirectoryEntry( "IIS://webserver/W3SVC/AppPools");
ArrayList appPoolNames = new ArrayList();
foreach(Directo ryEntry de in apppools.Childr en)
{
appPoolNames.Ad d(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.Director yServices.Direc toryEntry.Bind( Boolean throwIfFail)
at System.Director yServices.Direc toryEntry.Bind( )
at System.Director yServices.Direc toryEntry.get_I sContainer()
at System.Director yServices.Child Enumerator..cto r(DirectoryEntr y
container)
at System.Director yServices.Direc toryEntries.Get Enumerator()
at WebService1.Ser vice1.GetAllApp Pools() in
c:\inetpub\wwwr oot\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.

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
9609
by: hykim | last post by:
Hello, everyone. according to MSDN, there is any constructor of System.DirectoryServices.SearchResultCollection Class. if I implement DirectorySearcher.FindAll() method by myself, then how can I instanciate SearchResultCollection Class. more clearly, a SearchResult object is created, at the inside of FindAll() method, then how can I put this object into the SearchResultCollection object. there is any method releated to input operation.
0
1095
by: Barbara Alderton | last post by:
I have a asp.net application that needs to access Active Directory information. I setup the retrieval using System.DirectoryServices to access directReports of a user together with directReports of managers that the user is an assistant to. The problem is it takes a long time to retrieve the information (> 11 seconds). I then setup the retrieval using ADSI com object and the retrieval only takes 3 seconds. Using the getex method is a...
2
5796
by: Dave F. | last post by:
I just installed my ASP.NET app on a Win 2k server. I installed the files in a folder on D: and setup a virtual directory in IIS Default web. We had to install the Framework 1.1 and SP on this computer.When I attempt to run this app I get the error mentioned above. I granted ASPNET access to the folder on D: with Read & Execute, List Folder Contents and Read permissions. The Direcory Security for this app is set as Anonymous access, User...
3
8001
by: Shailesh Humbad | last post by:
I figured out what was causing the "Access is Denied" error when calling functions from referenced DLLs in my service. I've tried to be very detailed, so bear with me. It turns out that libraries I made myself were not having this problem, but it only happened with a zip library I downloaded and copied into my program's directory. When using classes from this library, my service threw an "Access Is Denied" FileLoadException, which...
2
7912
by: ad | last post by:
I have a virtual which is a web service. When I use the IP to get the web service, it return a access denied message: http://xxx.xxx.xxx.xxx/HealthService/Service.asmx but if I use local host, it is ok http://localhost/HealthService/Service.asmx I have set the virtual directory to allow anonymous. Why it still can't be accessed?
0
1447
by: Telos | last post by:
I'm trying to write a windows service which reads some emails from Exchange Server through WebDAV, using C#.NET 2.0. Everything works fine when testing, using a little Forms application to test all the backend classes. However, when I try to run the actual service it gets an access denied message when trying to get the emails. We have other services written in VB.NET 1.1 which use the exact same technique, and run on the same server......
4
21737
by: carson | last post by:
I have written two windows services: - service A does some crunching of local data files and uploads them to a central processing computer via http. - service B monitors a manifest file on a webserver to see if service A needs to be updated. What service B does if it sees their is an update for service A is to download a new copy of the service A executable, stop service A, replace the executable with the new copy, and start service B...
2
12869
by: =?Utf-8?B?RWRkaWU=?= | last post by:
Here is my scenario for a problem I can't solve. I am hosting a 3.5 WCF service in IIS on Windows Server 2003. The service works fine with the WCF test client in Visual Studio 2008 and from an ASP.Net client hosted on my development machine in VS2008. As soon as I deploy the ASP.net client to the "Same" IIS server, I get Access Denied messages. My goal is to use AD security groups so the authenticated user on the ASP.net page should be...
2
5334
by: =?Utf-8?B?bXVyYWRqYW1lcw==?= | last post by:
Yes, sorry I tried to make it clear in the original question that I want to get the user token of the service - ie. the account the service is running under. I know services don't have user tokens - I suspect users do have tokens, hence "user token", otherwise we might call them "service tokens" or somesuch :-) If you read the question again, you migh see that the fundamental question is, *assuming there is no other approach*: The...
0
8535
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9079
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6458
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4322
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4555
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2234
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1955
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.