473,385 Members | 1,740 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,385 software developers and data experts.

direct edit of the ii6s metabase.xml using c# or vb.net


I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this
code, trying to get a list of all defined websites, and write their name to
console, but it does not seem to work, would appreciate any pointers:

-----------
Try
Dim doc As New XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode

'Load the Xml file
'doc.Load("c:\windows\system32\inetsrv\metabase.xm l")

'Get the list of name nodes

nodelist = doc.SelectNodes("/MBProperty/IIsWebServer")

'Loop through the nodes

For Each node In nodelist
Dim siteName =
node.Attributes.GetNamedItem("ServerComment").Valu e
Console.WriteLine("Site: " & siteName)
Next

Catch errorVariable As Exception
'Error trapping
Console.Write(errorVariable.ToString())
End Try
-----------

Here's a sample metabase.xml file:
http://www.winnetmag.com/Files/11/22281/22281.zip
Nov 12 '05 #1
1 6232
I do not recommend to edit the metabase.xml file directly. You should go
through the ADSI interface or access the IIS metabase interface via COM
interop. I haven't seen any documentation that IIS would detect changes to
the metabase and reload the configuration. It's very likely that IIS will
overwrite changes you make to the XML file.

Are you sure that this is what you want to do?
--
HTH
Christoph Schittko [MVP]
Software Architect, .NET Mentor

"Roger" <ro******@hotmail.com> wrote in message
news:#c**************@TK2MSFTNGP11.phx.gbl...

I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this code, trying to get a list of all defined websites, and write their name to console, but it does not seem to work, would appreciate any pointers:

-----------
Try
Dim doc As New XmlDocument
Dim nodelist As XmlNodeList
Dim node As XmlNode

'Load the Xml file
'doc.Load("c:\windows\system32\inetsrv\metabase.xm l")

'Get the list of name nodes

nodelist = doc.SelectNodes("/MBProperty/IIsWebServer")

'Loop through the nodes

For Each node In nodelist
Dim siteName =
node.Attributes.GetNamedItem("ServerComment").Valu e
Console.WriteLine("Site: " & siteName)
Next

Catch errorVariable As Exception
'Error trapping
Console.Write(errorVariable.ToString())
End Try
-----------

Here's a sample metabase.xml file:
http://www.winnetmag.com/Files/11/22281/22281.zip

Nov 12 '05 #2

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

Similar topics

2
by: Keith | last post by:
I think we have a corrupt IIS metabase on our web cluster. The controller is replicating the problem to the members. What steps can we take to confirm our IIS metabase is intact? I would...
1
by: Roger | last post by:
I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this code, trying to get a list of all defined websites, and write their name to console, but it does not seem to work, would...
5
by: David Veeneman | last post by:
I had to reformat my Windows XP Professional development machine yesterday and reinstall everything, including IIS and VS 2005. I thought I had worked out the procedure to get ASP.NET up and...
0
by: and251076 | last post by:
Buongiorno, da pochi giorno ho installato la versione 2005 di Visual Studio, ma ahi mè non funziona tutto perfettamente. Infatti non riesco ad eseguite le miei applicazioni web in localhost. Se...
0
by: Will Holley | last post by:
I have a problem with cache headers which I cannot track down. We are running IIS6 on Windows Server 2003 and ASP.NET 2.0. Our application has an installer which sets up our caching options in...
1
by: Schemer | last post by:
Hello, I tried to load a web page from my local IIS, and got this error: ----------------------------- Failed to access IIS metabase. Description: An unhandled exception occurred during the...
2
by: =?Utf-8?B?SmliZXkgSmFjb2I=?= | last post by:
Hi: I'm getting this error when I try to browse to a .aspx page that is located on a virtual directory located on my Win XP Pro machine. There's more text in the page that is displayed that says...
3
sujithkrishnan
by: sujithkrishnan | last post by:
hi all... please help me in resolving this error.. i created a web service and i am not able to consume it in my app. When i browse that page am gettin an ERROR as follows.. Exception...
1
by: nagmvs | last post by:
Hello I am unable to upload More than 200kb in to my server and also i can downlaod only less than 4MB file from my server .When i am searching in internet i found solution as u can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.