ICorRuntimeHost::CreateDomainEx 方法ICorRuntimeHost::CreateDomainEx Method

创建应用程序域。Creates an application domain. 调用方将类型的接口指针接收 _AppDomain 到类型的实例 System.AppDomainThe caller receives an interface pointer, of type _AppDomain, to an instance of type System.AppDomain. 此方法允许调用方传递 IAppDomainSetup 实例,以配置返回的实例的附加功能 _AppDomainThis method allows the caller to pass an IAppDomainSetup instance to configure additional features of the returned _AppDomain instance.


HRESULT CreateDomainEx (  
    [in] LPCWSTR     pwzFriendlyName,  
    [in] IUnknown*   pSetup,  
    [in] IUnknown*   pIdentityArray,  
    [out] IUnknown** pAppDomain  


中用于给域指定友好名称的可选参数。[in] An optional parameter used to give a friendly name to the domain. 此友好名称可在用户界面(例如调试器)中显示,以标识域。This friendly name can be displayed in user interfaces such as debuggers to identify the domain.

中类型的可选接口指针 IAppDomainSetup ,由对ICorRuntimeHost:: CreateDomainSetup方法的调用获得。[in] An optional interface pointer of type IAppDomainSetup, obtained by a call to the ICorRuntimeHost::CreateDomainSetup method.

中指向实例的可选指针数组, IIdentity 这些实例表示通过安全策略映射以建立权限集的证据。[in] An optional array of pointers to IIdentity instances that represent evidence mapped through security policy to establish a permission set. IIdentity可以通过调用CreateEvidence方法来获取对象。An IIdentity object can be obtained by calling the CreateEvidence method.

弄类型为的接口指针 _AppDomain System.AppDomain ,可用于进一步控制域。[out] An interface pointer of type _AppDomain to an instance of System.AppDomain that can be used to further control the domain.

返回值Return Value

S_OKS_OK 操作成功。The operation was successful.
S_FALSES_FALSE 操作未能完成。The operation failed to complete.
E_FAILE_FAIL 发生了未知的灾难性故障。An unknown, catastrophic failure occurred. 如果方法返回 E_FAIL,则公共语言运行时(CLR)在该过程中将不再可用。If a method returns E_FAIL, the common language runtime (CLR) is no longer usable in the process. 对任何宿主 Api 的后续调用都会返回 HOST_E_CLRNOTAVAILABLE。Subsequent calls to any hosting APIs return HOST_E_CLRNOTAVAILABLE.
HOST_E_CLRNOTAVAILABLEHOST_E_CLRNOTAVAILABLE CLR 未加载到进程中,或 CLR 处于无法运行托管代码或成功处理调用的状态。The CLR has not been loaded into a process, or the CLR is in a state in which it cannot run managed code or process the call successfully.


CreateDomainEx通过允许调用方CreateDomain传入 IAppDomainSetup 具有属性值的实例来配置应用程序域,从而扩展了 CreateDomain 的功能。CreateDomainEx extends the capabilities of CreateDomain by allowing the caller to pass in an IAppDomainSetup instance with property values for configuring the application domain.


平台: 请参阅系统要求Platforms: See System Requirements.

标头: Mscoree.dllHeader: MSCorEE.h

库: 作为资源包括在 Mscoree.dll 中Library: Included as a resource in MSCorEE.dll

.NET Framework 版本: 1.0、1。1.NET Framework Version: 1.0, 1.1

另请参阅See also