答案 0 :(得分:0)
获取所有安装在IIS中的站点
fs watcher
获取端口
ServerManager serverManager = new ServerManager();
var sites = serverManager.Sites;
基于iis获取web.config
foreach(var site in sites)
{
//if only one binding
var port = site.Bindings[0].EndPoint.Port.ToString();
//if more than one binding
foreach(var binding in site.Bindings)
{
var port = binding.EndPoint.Port.ToString();
}
}
然后使用var applicationRoot = site.Applications.First(a => a.Path == "/");
var virtualRoot = applicationRoot.VirtualDirectories.First(v => v.Path == "/");
路径进行游戏,以从网站获取详细信息
virtualRoot