473,405 Members | 2,160 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Problem with directoryServices and authentication

Hello,
I am writing code, which will copy webServices from one IIS 6.0
webserver to another and using DirentoryServices to achieve this
purpose. And I have problems with authentication - I get an error
whenever I try to read properties of DirectoryEntry object. I had same
problems when I was using WMI, but there setting
ConnectionOptions co = new ConnectionOptions();
co.Authentication = AuthenticationLevel.PacketPrivacy;
solved the problem.
So perhaps a question would be - how can I set AuthenticationLevel to
PacketPrivacy, when I am using DirectoryServices?

Mar 6 '06 #1
7 2902

<tu****@gmail.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
| Hello,
| I am writing code, which will copy webServices from one IIS 6.0
| webserver to another and using DirentoryServices to achieve this
| purpose. And I have problems with authentication - I get an error
| whenever I try to read properties of DirectoryEntry object. I had same
| problems when I was using WMI, but there setting
| ConnectionOptions co = new ConnectionOptions();
| co.Authentication = AuthenticationLevel.PacketPrivacy;
| solved the problem.
| So perhaps a question would be - how can I set AuthenticationLevel to
| PacketPrivacy, when I am using DirectoryServices?
|

Check the AuthenticationTypes enum in System.DirectoryServices. If you are
binding to the IIS metadata you need at least
AuthenticationTypes.Encryption.
Willy.

Mar 6 '06 #2
WEll, I am using
AuthenticationType = AuthenticationTypes.Secure |
AuthenticationTypes.Signing | AuthenticationTypes.Encryption |
AuthenticationTypes.Delegation
but this does not work. Any other ideas?

Mar 6 '06 #3
Now I am starting to doubt that it's the authentication rpoblem....

the code just does not work....

here is the code:

public class WSMigration
{
private string srcServer,dstServer;

public WSMigration(string srcServer, string dstServer)
{
this.srcServer = srcServer;
this.dstServer=dstServer;
}

public void MigrateSettings()
{
DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + srcServer);
W3SVC.AuthenticationType = AuthenticationTypes.Encryption;
this.SearchRelatedSettings(W3SVC);
}

private void SearchRelatedSettings(DirectoryEntry ent)
{
ent.AuthenticationType = AuthenticationTypes.Encryption;
foreach (DirectoryEntry n in ent.Children)
{
n.AuthenticationType = AuthenticationTypes.Encryption;
if(n.Name.ToLower().Replace("bt","tb") != n.Name.ToLower())
{
this.CopyWithHierarchy(n);
}
}

private DirectoryEntry CopyWithHierarchy(DirectoryEntry source)
{
if (source.Parent.Name.ToLower() == "w3svc"/*srcServer.ToLower()*/)
{
DirectoryEntry par = new DirectoryEntry("IIS://" + dstServer +
"/W3SVC");
DirectoryEntry de = source.CopyTo(par);
par.CommitChanges();
return de;
}
else
{
return source.CopyTo(this.CopyWithHierarchy(source.Parent ));
}
}

public void MigrateFiles()
{
//Copies all neccesary files
}
}

I'd be very gratefull if someone could review this.

Mar 6 '06 #4
| the code just does not work....
is of little help here, please be more specific. Where does it fail, any
exceptions.. stacktraces..?

Willy.

"LT_Hassan" <tu****@gmail.com> wrote in message
news:11*********************@i39g2000cwa.googlegro ups.com...
| Now I am starting to doubt that it's the authentication rpoblem....
|
| the code just does not work....
|
| here is the code:
|
| public class WSMigration
| {
| private string srcServer,dstServer;
|
| public WSMigration(string srcServer, string dstServer)
| {
| this.srcServer = srcServer;
| this.dstServer=dstServer;
| }
|
| public void MigrateSettings()
| {
| DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + srcServer);
| W3SVC.AuthenticationType = AuthenticationTypes.Encryption;
| this.SearchRelatedSettings(W3SVC);
| }
|
| private void SearchRelatedSettings(DirectoryEntry ent)
| {
| ent.AuthenticationType = AuthenticationTypes.Encryption;
| foreach (DirectoryEntry n in ent.Children)
| {
| n.AuthenticationType = AuthenticationTypes.Encryption;
| if(n.Name.ToLower().Replace("bt","tb") != n.Name.ToLower())
| {
| this.CopyWithHierarchy(n);
| }
| }
|
| private DirectoryEntry CopyWithHierarchy(DirectoryEntry source)
| {
| if (source.Parent.Name.ToLower() == "w3svc"/*srcServer.ToLower()*/)
| {
| DirectoryEntry par = new DirectoryEntry("IIS://" + dstServer +
| "/W3SVC");
| DirectoryEntry de = source.CopyTo(par);
| par.CommitChanges();
| return de;
| }
| else
| {
| return source.CopyTo(this.CopyWithHierarchy(source.Parent ));
| }
| }
|
| public void MigrateFiles()
| {
| //Copies all neccesary files
| }
| }
|
| I'd be very gratefull if someone could review this.
|
Mar 6 '06 #5
Oh, sorry, forgot that.
So it fails in method CopyWithHierarchy() at line "DirectoryEntry de =
source.CopyTo(par);" with

"An unhandled exception of type
'System.Runtime.InteropServices.COMException' occurred in
system.directoryservices.dll

Additional information: Exception from HRESULT: 0x80005000."
Stack trace follows:
[<Non-user Code>]
migratewebservices.dll!MigrateWebServices.WSMigrat ion.CopyWithHierarchy(System.DirectoryServices.Dir ectoryEntry source = {System.DirectoryServices.DirectoryEntry}) Line 74 + 0xd bytes C#


migratewebservices.dll!MigrateWebServices.WSMigrat ion.CopyWithHierarchy(System.DirectoryServices.Dir ectoryEntry
source = {System.DirectoryServices.DirectoryEntry}) Line 80 + 0x21
bytes C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.CopyWithHierarchy(System.DirectoryServices.Dir ectoryEntry
source = {System.DirectoryServices.DirectoryEntry}) Line 80 + 0x21
bytes C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.SearchRelatedSettings(System.DirectoryServices .DirectoryEntry
ent = {System.DirectoryServices.DirectoryEntry}) Line 57 C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.SearchRelatedSettings(System.DirectoryServices .DirectoryEntry
ent = {System.DirectoryServices.DirectoryEntry}) Line 41 + 0xec
bytes C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.SearchRelatedSettings(System.DirectoryServices .DirectoryEntry
ent = {System.DirectoryServices.DirectoryEntry}) Line 41 + 0xec
bytes C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.SearchRelatedSettings(System.DirectoryServices .DirectoryEntry
ent = {System.DirectoryServices.DirectoryEntry}) Line 41 + 0xec
bytes C#

migratewebservices.dll!MigrateWebServices.WSMigrat ion.MigrateSettings()
Line 36 C#
TestApp.exe!TestApp.Class1.Main(string[] args = {Length=0}) Line
28 C#

Mar 6 '06 #6
So no ideas? I have to finish this project today, because we are having
a major serving migration tomorow, and witout this software it will be
much more work....

Mar 6 '06 #7

"LT_Hassan" <tu****@gmail.com> wrote in message
news:11**********************@p10g2000cwp.googlegr oups.com...
| So no ideas? I have to finish this project today, because we are having
| a major serving migration tomorow, and witout this software it will be
| much more work....
|

Are you trying to copy DirectoryEntry objects from one metabase to another,
that is on different servers? That's not possible with CopyTo, both entries
must reside within the same directory (metabase) as CopyTo acts on a single
connection.

What you need to do is re-create the same object hierarchy at the
destination, so you'll have to retrieve the objects and properties from the
source and re-create them on the dest.

Willy.
Mar 6 '06 #8

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

Similar topics

2
by: bob | last post by:
Hi, Is this the right place to dicuss Visual Studio 2005 and .Net 2? I am try to implement a class (already using Windows Authentication) where I am given a user name and I return a list of...
7
by: Amar | last post by:
I am trying to connect to my college LDAP directory using ASP.NET. This LDap does not have security as it returns only user demographic information. i do not need to bind with a username or...
1
by: Stephanie Stowe | last post by:
Hi. I am trying to read information out of the IIS metabase (v5.1). Observe the following code: using System; using System.DirectoryServices; using System.Reflection; namespace ADSI1 {...
1
by: Günther Rühmann | last post by:
Hi, I´m not sure if i´m right int this group... My problem: I made a vb .net application that reads from AD via System.Directoryservices.Directoryentry. The appliocation enumerates group...
1
by: Robin | last post by:
When using the following ASP.Net code the error "The directory service cannot perform the requested operation on the RDN attribute of an object." is displayed when the commit changes is run. What...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
5
by: Keith Jakobs, MCP | last post by:
Hi All.... I'm having a HECK of a time connecting to Active Directory using VB in Visual Studio.NET 2003. Can anyone PLEASE help me? All I am trying to do is list the current members of our...
0
by: ssg31415926 | last post by:
I'm using System.DirectoryServices to access a Domino LDAP server. When I get a failed authentication, I usually see this: System.Runtime.InteropServices.COMException 0x8007052E: "Logon failure:...
0
by: gnewsgroup | last post by:
Sorry for the cross-post. I do have this posted in the aspnet security group. I notice there are a lot of "persecution" spams over there and I am afraid my post will be innundated. So, here it is....
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
0
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...

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.