ModuleService 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
提供用于 (IIS Manager 扩展) 实现新管理模块的基类。
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 类应包含管理模块的所有程序逻辑。
模块服务是一种 Web 服务,它执行代码来实现访问和修改管理信息的功能。
构造函数
ModuleService() |
初始化 ModuleService 类的新实例。 |
属性
Context |
获取模块服务的管理上下文。 |
ManagementUnit |
ManagementUnit获取当前由模块服务管理的 。 |
ModuleName |
获取包含模块服务的程序集的名称。 |
方法
CreateChildService(Type) |
创建子 ModuleService 对象。 |
RaiseException(Exception) |
提供用于 (IIS Manager 扩展) 实现新管理模块的基类。 |
RaiseException(String) |
WebManagementServiceException根据指定的资源名称引发 。 |
RaiseException(String, String) |
WebManagementServiceException根据指定的资源名称和错误消息引发 。 |
适用于
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈