Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

ModuleService Class

Provides the base class for implementing new management modules (IIS Manager extensions). 

Namespace:  Microsoft.Web.Management.Server
Assembly:  Microsoft.Web.Management (in Microsoft.Web.Management.dll)
public abstract class ModuleService

The ModuleService type exposes the following members.

  NameDescription
Protected methodModuleServiceInitializes a new instance of the ModuleService class.
Top
  NameDescription
Public propertyContextGets the management context of the module service.
Protected propertyManagementUnitGets the ManagementUnit that is currently being managed by the module service.
Protected propertyModuleNameGets the name of the assembly that contains the module service.
Top
  NameDescription
Protected methodCreateChildServiceCreates a child ModuleService object.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodRaiseException(Exception)Throws a WebManagementServiceException based on the specified exception.
Protected methodRaiseException(String)Throws a WebManagementServiceException based on the specified resource name.
Protected methodRaiseException(String, String)Throws a WebManagementServiceException based on the specified resource name and error message.
Public methodToString (Inherited from Object.)
Top

The ModuleService members are exposed through the ModuleServiceProxy class. A derived ModuleService class should contain all the program logic for the management module.

A module service is a Web service that executes code to implement the features that access and modify management information.

The following example shows how to create a simple class that derives from the ModuleService class and retrieves the application's settings.

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;
        }



Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.