WmiConfigurationAttribute.HostingModel Property

 

Gets or sets the hosting model for the WMI provider.

Namespace:   System.Management.Instrumentation
Assembly:  System.Core (in System.Core.dll)

public ManagementHostingModel HostingModel { get; set; }

Property Value

Type: System.Management.Instrumentation.ManagementHostingModel

A ManagementHostingModel value that indicates the hosting model of the WMI provider.

WMI providers can be hosted by an application or by the WMI service. WMI providers hosted by an application are called decoupled providers. Those hosted by the WMI service are called in-process providers. The hosting model value determines both the hosting model and, in the case of in-process providers, the account (security context) under which the provider runs. For more detail about the possible values of HostingModel, see ManagementHostingModel.

To learn more about hosting models, see the Provider Hosting and Security topic in the WMI SDK on MSDN.

In the following example, the WmiConfigurationAttribute is used to indicate that the assembly it is contained in implements a provider that is exposed through the root\NVPair namespace. Because the hosting model is not Decoupled, it is an in-process provider. The value NetworkService indicates that the in-process provider runs under the NetworkService security context.

[assembly: WmiConfiguration("root\\NVPair", HostingModel = ManagementHostingModel.NetworkService)]

In the next example, the WmiConfigurationAttribute is used to indicate that the assembly it is contained in implements a provider that is exposed through the root\NVPair namespace. The value Decoupled indicates that it is a decoupled provider.

[assembly: WmiConfiguration("root\\NVPair", HostingModel = ManagementHostingModel.Decoupled)]

.NET Framework
Available since 3.5
Return to top
Show: