Reputation: 985
We would like to build an Admin Checklist page that allows our network administrators to quickly view all the setting in the IIS and web config to easily trouble an issue. the web config is fairly easy but I'm not sure how to get the stuff from IIS. (App Pool Name and type, Machine Key, Anonymous Authentication, etc.) I'm sure it can be done, I just don't know how.
Thanks,
Rhonda
Upvotes: 0
Views: 217
Reputation: 504
The information you're looking for are exposed in the IIS .Net APIs. You can find them in \windows\system32\inetsrv (they are Microsoft.Web.Administration.dll, and maybe Microsoft.Web.Management.dll).
Sample code to get ID and application pool name for each site :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Web.Administration;
namespace ConsoleApplication79
{
class Program
{
static void Main(string[] args)
{
ServerManager s = new ServerManager();
var q = s.Sites.Select(aSite => new
{
ID = aSite.Id,
AppPoolName = aSite.Applications.First().ApplicationPoolName
});
foreach (var item in q)
{
Console.WriteLine("ID: {0}, PoolName: {1}", item.ID, item.AppPoolName);
}
}
}
}
Upvotes: 1