Gets or sets the hosting model for the WMI provider.
Assembly: System.Core (in System.Core.dll)
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)]
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.