다음을 통해 공유


ModuleService 클래스

정의

새 관리 모듈(IIS 관리자 확장)을 구현하기 위한 기본 클래스를 제공합니다.

public ref class ModuleService abstract
public abstract class ModuleService
type ModuleService = class
Public MustInherit Class ModuleService
상속
ModuleService
파생

예제

다음 예제에서는 클래스에서 ModuleService 파생되고 애플리케이션의 설정을 검색하는 간단한 클래스를 만드는 방법을 보여 줍니다.

using System;
using System.Diagnostics;               // for Trace.WriteLine
using System.Collections;
using System.Security.Principal;        // for WindowsBuiltInRole
using Microsoft.Web.Administration;
using Microsoft.Web.Management.Server;

namespace rxDemo {
    public class DemoModuleService : ModuleService {

        ArrayList _infoLst = new ArrayList();

        [ModuleServiceMethod]
        public ArrayList GetSettings() {                    // expose GetSettings
            ConfigurationSection appSettingsSection = ManagementUnit.Configuration.GetSection("appSettings");

            ConfigurationElementCollection settings = appSettingsSection.GetCollection();

            ArrayList settingsList = new ArrayList();
            foreach (ConfigurationElement setting in settings) {
                PropertyBag settingBag = new PropertyBag();

                settingBag[0] = setting.GetAttribute("key").Value;
                settingBag[1] = setting.GetAttribute("value").Value;
                settingBag[2] = setting.IsLocallyStored ? "Local" : "Inherited";
                settingsList.Add(settingBag);
            }
            if (settingsList.Count < 1) {            // If there are no setting
                AddEmptyData();                     // Add info so we know our code
                return _infoLst;                   // is working.
            }
            TraceInternal();

            return settingsList;
        }

설명

멤버는 ModuleService 클래스를 ModuleServiceProxy 통해 노출됩니다. 파생 ModuleService 클래스는 관리 모듈에 대한 모든 프로그램 논리를 포함해야 합니다.

모듈 서비스는 관리 정보에 액세스하고 수정하는 기능을 구현하는 코드를 실행하는 웹 서비스입니다.

생성자

ModuleService()

ModuleService 클래스의 새 인스턴스를 초기화합니다.

속성

Context

모듈 서비스의 관리 컨텍스트를 가져옵니다.

ManagementUnit

ManagementUnit 모듈 서비스에서 현재 관리 중인 을 가져옵니다.

ModuleName

모듈 서비스를 포함하는 어셈블리의 이름을 가져옵니다.

메서드

CreateChildService(Type)

자식 ModuleService 개체를 만듭니다.

RaiseException(Exception)

새 관리 모듈(IIS 관리자 확장)을 구현하기 위한 기본 클래스를 제공합니다.

RaiseException(String)

지정된 리소스 이름을 기반으로 을 throw합니다 WebManagementServiceException .

RaiseException(String, String)

WebManagementServiceException 지정된 리소스 이름 및 오류 메시지를 기반으로 을 throw합니다.

적용 대상