开发者

What is the new method of querying the metabase in IIS 7?

开发者 https://www.devze.com 2023-01-14 09:16 出处:网络
In IIS 6, I typically used code to query the metabase as in the following: var entry = new DirectoryEntry(\"IIS://localhost/W3SVC\");

In IIS 6, I typically used code to query the metabase as in the following:

var entry = new DirectoryEntry("IIS://localhost/W3SVC");
foreach (DirectoryEntry site in entry.Children)
{
// Blah
}

Now in IIS 7, this only functions if IIS 6 compatibility is installed. What I'd really like to do is use the recommended IIS 7 way of doing things.

My question is this. What is the "proper" way to get information from the IIS 7开发者_如何学编程 metabase on a local or remote machine in code without requiring IIS 6 compatibility mode?


The new way is to use the Microsoft.Web.Administration namespace:

http://msdn.microsoft.com/en-us/library/microsoft.web.administration(VS.90).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消