简体   繁体   English

如何正确链接已安装的Web应用程序名称及其虚拟目录名称?

[英]How to correctly link the installed web application name and its virtual directory name?

Using ServerManager, I can get the list of virtual directories for my installed web applications. 使用ServerManager,可以获得安装的Web应用程序的虚拟目录列表。 I can also verify if a specific web application is installed using registry key search. 我还可以使用注册表项搜索来验证是否安装了特定的Web应用程序。 I am, however, unable to locate the web application physical path that is usually in inetpub\\wwwroot. 但是,我无法找到通常在inetpub \\ wwwroot中的Web应用程序物理路径。

InstallLocation field in the related registry does not have any value. 相关注册表中的InstallLocation字段没有任何值。 How can I achieve this? 我该如何实现?

You can use DirectoryEntry to browse the IIS configuration. 您可以使用DirectoryEntry浏览IIS配置。 Here is an example pulled from another question : 这是另一个问题的例子:

void ListVirtualDirectories(string serverName, int siteId) {            
   DirectoryEntry iisServer = new DirectoryEntry("IIS://" + serverName + "/W3SVC/" + siteId + "/ROOT");

   foreach (DirectoryEntry webDir in iisServer.Children) {
       if (webDir.SchemaClassName.Equals("IIsWebVirtualDir"))
               Console.WriteLine("Found virtual directory {0}", webDir.Name);
   }
}

The siteId is a numerical value corresponding to each site listed in IIS. siteId是与IIS中列出的每个站点相对应的数值。 This method forces you to provide it, but you could find all the sites on the server too if you wanted. 此方法强制您提供它,但是如果需要,您也可以在服务器上找到所有站点。 Just search Google for that if you need it. 只需在Google中搜索即可。 But this should get you started. 但这应该可以帮助您入门。

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

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