List all websites in IIS c#

前端 未结 3 1269
无人共我
无人共我 2020-12-05 11:06

Is there a way to list all active websites that exist within IIS using c#?

Thanks

Sp

3条回答
  •  不知归路
    2020-12-05 11:29

    For IIS 7 you can use Microsoft.Web.Administration.dll (C:\Windows\System32\inetsrv) and the following code

            var iisManager = new ServerManager();
            SiteCollection sites = iisManager.Sites;
    

提交回复
热议问题