문제

현재 팜의 모든 SPIisWebServiceApplicationPool 목록을 얻는 방법은 무엇입니까? PowerShell 객체를 사용하지 않고 C # 응용 프로그램에서 목록을 가져 오려고하는 PowerShell 명령이 있습니다.

도움이 되었습니까?

해결책

다음을 사용해보십시오. 각 웹 전 장치에 기본적으로 기본적으로 존재하는 서비스에 따라 수정할 수 있습니다.

foreach (SPService service in SPFarm.Local.Services)
{
    if (service.Name.Equals("ServiceName"))
    {
        foreach (SPServiceApplication serviceApp in service.Applications)
        {
            SPIisWebServiceApplication webServiceApp = (SPIisWebServiceApplication) serviceApp;
            SPIisWebServiceApplicationPool appPool = webServiceApp.ApplicationPool;
        }
    }
}
.

다른 팁

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.DirectoryServices;

namespace AppPoolEnum
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryEntries appPools = 
                new DirectoryEntry("IIS://localhost/W3SVC/AppPools").Children;

            foreach (DirectoryEntry appPool in appPools)
            {
                Console.WriteLine(appPool.Name);
            }
        }
    }
}
.

출처 : https://stackoverflow.com/questions/1400464/Enumeration-Application-pools.-IIS

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top