473,594 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

something wrong with my use of System.Director yServices

Hi. I am trying to read information out of the IIS metabase (v5.1). Observe
the following code:

using System;
using System.Director yServices;
using System.Reflecti on;

namespace ADSI1
{
class ConfigIIS
{
[STAThread]
static void Main(string[] args)
{
string serverName = "localhost" ;
string password = "Y@ms,M0s";
DirectoryEntry site = new DirectoryEntry
("IIS://localhost/W3SVC/1/Root/Stowesoft", "localhost\\adm inistrator",
password, AuthenticationT ypes.Secure);
Console.WriteLi ne ( site.Path );
Console.WriteLi ne();

foreach ( string propName in site.Properties .PropertyNames)
{
Console.WriteLi ne(propName);
foreach (object value in site.Properties[propName])
{
Console.WriteLi ne("\tname = " + propName + ", value = "
+ value);
}
}

Console.WriteLi ne("Done");

}
}
}

At foreach(string propName in site.Properties .ProerptyNames)

I receive the runtime error

An unhandled exception of type 'System.NotSupp ortedException' occurred in
system.director yservices.dll

Additional information: The directory cannot report the number of
properties.

I do not NEED to iterate through the properties so much as check the values
of the properties that I want. My underlying goal is to compare the IIS
setup on a production server to the known desired values. So I want to be
able to read the IIS metabase for virtual root. So for a given virtual root,
what are the application settings, what is the local path, authentication
information...

I don't know how to find out these property names. So I either

- need to learn what is wrong with my code for iterating through the
properties OR
- need to know the name of the properties (from some documentation I could
not find that perhaps one could point me to) available so that I can get the
values directly.

Thanks for your help!

Stephanie
Nov 16 '05 #1
1 4851
Running following on W2K3 (IIS6):
{
DirectoryEntry de = new DirectoryEntry( "IIS://scenic/W3SVC/1/root",
"administrator" , "pwd",
AuthenticationT ypes.Secure);

foreach( string myKey in de.Properties.P ropertyNames)
{
Console.WriteLi ne(myKey + " " + de.Properties[myKey].Value);
}
}

dumps :
AccessFlags 513
AccessSSLFlags 0
AppIsolated 2
AuthFlags 5
FrontPageWeb True
AppFriendlyName Default Application
AppPoolId DefaultAppPool
AppRoot /LM/W3SVC/1/ROOT
KeyType IIsWebVirtualDi r
Path d:\inetpub\wwwr oot
HttpCustomHeade rs System.Object[]
ScriptMaps System.Object[]
DefaultDoc Default.htm,Def ault.asp,index. htm,iisstart.ht m,Default.aspx
AppAllowClientD ebug False
AppAllowDebuggi ng False
AspAllowOutOfPr ocComponents True
AspAllowSession State True
AspAppServiceFl ags 0
AspBufferingLim it 4194304
AspBufferingOn True
AspCalcLineNumb er True
AspCodepage 0
AspEnableApplic ationRestart True
AspEnableAspHtm lFallback False
AspEnableChunke dEncoding True
AspEnableParent Paths False
AspEnableTypeli bCache True
AspErrorsToNTLo g False
AspExceptionCat chEnable True
AspExecuteInMTA 0
AspKeepSessionI DSecure 0
AspLCID 2048
AspLogErrorRequ ests True
AspMaxDiskTempl ateCacheFiles 2000
AspMaxRequestEn tityAllowed 204800
AspProcessorThr eadMax 25
AspQueueConnect ionTestTime 3
AspQueueTimeout -1
AspRequestQueue Max 3000
AspRunOnEndAnon ymously True
AspScriptEngine CacheMax 250
AspScriptErrorS entToBrowser True
AspScriptFileCa cheSize 500
AspScriptTimeou t 90
AspSessionMax -1
AspSessionTimeo ut 20
AspTrackThreadi ngModel False
BITSAllowOverwr ites 0
BITSHostIdFallb ackTimeout 86400
BITSServerNotif icationType 0
BITSSessionTime out 1209600
CGITimeout 300
ContentIndexed True
DirBrowseFlags 1073741886
PasswordChangeF lags 6
AnonymousUserNa me IUSR_SCENIC
AnonymousUserPa ss %Z33<cyw@;8*Rt
AspScriptErrorM essage An error occurred on the server when processing the
URL.
Please contact the system administrator.
AspScriptLangua ge VBScript
AuthChangeURL /iisadmpwd/achg.asp
AuthExpiredUnse cureURL /iisadmpwd/aexp3.asp
AuthExpiredURL /iisadmpwd/aexp.asp
AuthNotifyPwdEx pUnsecureURL /iisadmpwd/anot3.asp
AuthNotifyPwdEx pURL /iisadmpwd/anot.asp
BITSHostId
BITSMaximumUplo adSize 184467440737095 51615
BITSServerNotif icationURL
BITSSessionDire ctory BITS-Sessions
HttpExpires D, 0x15180
AdminACL System.__ComObj ect
AspDiskTemplate CacheDirectory %windir%\system 32\inetsrv\ASP Compiled
Templates
HttpErrors System.Object[]

Willy.
"Stephanie Stowe" <No****@IWishIC ould.com> wrote in message
news:Or******** ******@TK2MSFTN GP12.phx.gbl...
Hi. I am trying to read information out of the IIS metabase (v5.1).
Observe
the following code:

using System;
using System.Director yServices;
using System.Reflecti on;

namespace ADSI1
{
class ConfigIIS
{
[STAThread]
static void Main(string[] args)
{
string serverName = "localhost" ;
string password = "Y@ms,M0s";
DirectoryEntry site = new DirectoryEntry
("IIS://localhost/W3SVC/1/Root/Stowesoft", "localhost\\adm inistrator",
password, AuthenticationT ypes.Secure);
Console.WriteLi ne ( site.Path );
Console.WriteLi ne();

foreach ( string propName in site.Properties .PropertyNames)
{
Console.WriteLi ne(propName);
foreach (object value in site.Properties[propName])
{
Console.WriteLi ne("\tname = " + propName + ", value = "
+ value);
}
}

Console.WriteLi ne("Done");

}
}
}

At foreach(string propName in site.Properties .ProerptyNames)

I receive the runtime error

An unhandled exception of type 'System.NotSupp ortedException' occurred in
system.director yservices.dll

Additional information: The directory cannot report the number of
properties.

I do not NEED to iterate through the properties so much as check the
values
of the properties that I want. My underlying goal is to compare the IIS
setup on a production server to the known desired values. So I want to be
able to read the IIS metabase for virtual root. So for a given virtual
root,
what are the application settings, what is the local path, authentication
information...

I don't know how to find out these property names. So I either

- need to learn what is wrong with my code for iterating through the
properties OR
- need to know the name of the properties (from some documentation I could
not find that perhaps one could point me to) available so that I can get
the
values directly.

Thanks for your help!

Stephanie

Nov 16 '05 #2

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

Similar topics

12
9598
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.
1
16179
by: Gaab | last post by:
Hi Folks, After the weekend I wanted to start working on my c#/asp.net project, but when I tried to open it on my machine i got the following error: Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
0
2523
by: Chris Frohlich | last post by:
All, I've built an Employee Directory with ASP.NET app that queries Active Directory for users and builds links with the results. What I'm seeing is really intermittent failures to bind to the directory. I'll log into the app twice with the same account and sometimes it works, while with others I get the following: System.Runtime.InteropServices.COMException (0x80072020): An operations error occurred at...
2
5439
by: Kelvin | last post by:
Hello I am using web matrix develop a login page through Active Directory but I cannot figure out why it is giving me an error when importing system.directoryServices. Any help will do! thank Compiler Error Message: BC30466: Namespace or type 'DirectoryServices' for the Imports 'System.DirectoryServices' cannot be found Line 2: Imports System.Tex Line 3: Imports System.Collection Line 4: Imports System.DirectoryService Line 5:
0
2244
by: RSH | last post by:
I am using System.DirectoryServices to query our AD in order to get information about users. I am having problems understanding how to get at the Username and the Email address (to begin with) The code below returns all of the keys (I assume) but I can't figure out how to extract the values associated with them: Here is the code I'm using:
6
4072
by: Mark Rae | last post by:
Hi, I'm in the process of updating an ASP.NET v1.1 web app to v2. The app uses ActiveDirectory a great deal, and I'm trying to use the new System.Collections.Generic namespace where possible, having been advised by several luminaries that that is a "good thing to do"... :-) However, I'm experiencing a problem with the IEnumerable interface. (N.B. I understand fully that I should be using the LDAP provider instead of the WinNT provider...
1
11418
by: sasikumarks | last post by:
Hi, Im using the following code to retrieve the user details from the AD server. But when i execute the code,it throws me the error. Please help me in this regards."System.Runtime.InteropServices.COMException (0x8007052E): Logon failure: unknown user name or bad password. at System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail) at System.DirectoryServices.DirectoryEntry.Bind() at...
1
3166
by: aamirghanchi | last post by:
Hi, I recently converted an ASP .net 1.1 project to 2.0 in VS 2005. Even though System.DirectoryServices reference has been added to the project, still for some reasons the Imports System.DirectoryServices is not being recognized and there is a build time warning on it stating: Namespace or type specified in the Imports System.DirectoryServices doesn't contain any public member or cannot be found. Make sure the namespace or the type is...
7
16287
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work on the other domain. Other functions work on the other domain like get all the users and get all the groups and I can validate users on the other domain so I think I am communciating with the other domain OK just not with the...
0
7947
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7880
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
8255
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...
1
8010
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8242
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
3868
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
3903
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1486
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1217
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.