简体   繁体   English

如何列出IIS服务器托管的所有网站(不是应用程序)?

[英]How do you list all the web sites (not applications) being hosted by an IIS server?

我在Windows Server 2003上使用IIS 6.目标是创建这些应用程序的目录,显示其URL(服务器上的端口)和名称。

I haven't done it, but I believe you need to use the following WMI object: 我还没有这样做,但我相信你需要使用以下WMI对象:

DirectoryEntry w3svc = new DirectoryEntry(string.Format("IIS://{0}/w3svc", serverName));
foreach (DirectoryEntry site in w3svc.Children)
{
     //these are the web sites, lookup their properties to see how to extract url
}

C# example: link text C#示例: 链接文本

or 要么

This is a VB example, but I think you will use this idea: link text 这是一个VB示例,但我认为您将使用这个想法: 链接文本

strComputer = "."

Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
    & strComputer & "\root\microsoftiisv2")
Set colItems = objWMIService.ExecQuery("Select * from IIsWebVirtualDir")
For Each objItem in colItems
  Wscript.Echo "Application Isolated: " & objItem.AppIsolated
  Wscript.Echo "Application Package ID: " & objItem.AppPackageID
  Wscript.Echo "Application Package Name: " & objItem.AppPackageName
  Wscript.Echo "Application Root: " & objItem.AppRoot
  Wscript.Echo "Installation Date: " & objItem.InstallDate
  Wscript.Echo "Name: " & objItem.Name
Next

In addition to above solutions, assuming if your application is not running on the same server machine where the IIS is, in that case you will need to write a TCPClient to perform Reverse DNS on the IP of the IIS server. 除了上述解决方案之外,假设您的应用程序未在IIS所在的同一台服务器上运行,在这种情况下,您需要编写TCPClient以在IIS服务器的IP上执行反向DNS

By defination Reverse DNS means: 通过定义反向DNS意味着:

In computer networking, reverse DNS lookup or reverse DNS resolution (rDNS) is the determination of a domain name that is associated with a given IP address using the Domain Name System (DNS) of the Internet. 在计算机网络中,反向DNS查找或反向DNS解析(rDNS)是使用因特网的域名系统(DNS)确定与给定IP地址相关联的域名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM