ModuleService Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides the base class for implementing new management modules (IIS Manager extensions).
public ref class ModuleService abstract
public abstract class ModuleService
type ModuleService = class
Public MustInherit Class ModuleService
- Inheritance
-
ModuleService
- Derived
Examples
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;
}
Remarks
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.
Constructors
ModuleService() |
Initializes a new instance of the ModuleService class. |
Properties
Context |
Gets the management context of the module service. |
ManagementUnit |
Gets the ManagementUnit that is currently being managed by the module service. |
ModuleName |
Gets the name of the assembly that contains the module service. |
Methods
CreateChildService(Type) |
Creates a child ModuleService object. |
RaiseException(Exception) | |
RaiseException(String, String) |
Throws a WebManagementServiceException based on the specified resource name and error message. |
RaiseException(String) |
Throws a WebManagementServiceException based on the specified resource name. |