我如何可以在磁盘上获得站点的物理路径?
using (ServerManager serverManager = new ServerManager()) { var sites = serverManager.Sites; foreach (Site site in sites) { Console.WriteLine(site.Name); // This will return the WebSite name //but how i get it's path on disc ?????? }
解决方法
ServerManager m = new ServerManager(); m.Sites["default web site"].Applications["/"].VirtualDirectories["/"].PhysicalPath;
基本上每个站点都有一个“根应用程序”,它必须有一个“根虚拟目录”.