示例#1
0
        public async Task <object> Get()
        {
            Dictionary <string, ApplicationPool> pools     = ManagementUnit.ServerManager.ApplicationPools.ToDictionary(p => p.Name);
            IEnumerable <IAppPoolSnapshot>       snapshots = await _monitor.GetSnapshots(pools.Values);

            return(new {
                app_pools = snapshots.Select(snapshot => AppPoolHelper.ToJsonModel(snapshot, pools[snapshot.Name], Context.Request.GetFields()))
            });
        }
示例#2
0
        public async Task <object> Get(string id)
        {
            string name = AppPoolId.CreateFromUuid(id).Name;

            ApplicationPool  pool     = AppPools.AppPoolHelper.GetAppPool(name);
            IAppPoolSnapshot snapshot = null;

            if (pool != null)
            {
                snapshot = (await _monitor.GetSnapshots(new ApplicationPool[] { pool })).FirstOrDefault();
            }

            if (snapshot == null)
            {
                return(NotFound());
            }

            return(AppPoolHelper.ToJsonModel(snapshot, pool, Context.Request.GetFields()));
        }