3.9.4.1 CreateApplication (Opnum 3)
The CreateApplication method creates a new application at the specified metabase path.
-
HRESULT CreateApplication( [in, unique, string] LPCWSTR szMDPath, [in] DWORD dwAppMode, [in, unique, string] LPCWSTR szAppPoolId, [in] BOOL fCreatePool );
szMDPath: A pointer to a Unicode string that contains the metabase path of the application.
dwAppMode: An unsigned 32-bit integer value indicating the process where the application will run. This parameter MUST be set to one of the following values.
-
Value
Meaning
eAppRunInProc
0x00000000
The application runs in the IIS parent process.
eAppRunOutProcIsolated
0x00000001
The application runs in its own process.
eAppRunOutProcInDefaultPool
0x00000002
The application runs in a shared process with other applications outside of the IIS parent process.
szAppPoolId: A pointer to a Unicode string that specifies the application pool name with which to associate the new application.
fCreatePool: A flag indicating whether to create a new application pool if the pool specified by the szAppPoolId parameter does not exist (TRUE) or to use an existing application pool (FALSE).
Return Values: A signed 32-bit value that indicates return status. If the method returns a negative value, it failed. If the 12-bit facility code (bits 16–27) is set to 0x007, the value contains a Win32 error code in the lower 16 bits. Zero or positive values indicate success, with the lower 16 bits in positive nonzero values containing warnings or flags defined in the method implementation. For more information about Win32 error codes and HRESULT values, see [MS-ERREF].
-
Return value/code
Description
0x00000000
S_OK
The call was successful.
0x80070057
E_INVALIDARG
One or more arguments are invalid.
0x80070490
ERROR_NOT_FOUND
Element not found.
The opnum field value for this method is 3.
When processing this call, the server MUST do the following:
The server SHOULD validate that the metabase path specified in the szMDPath parameter is a valid application path.<29>
If the string length of the szMDPath parameter is <= 10, return E_INVALIDARG.
Check that the path specified in szMDPath exists in the metabase. If it does not, create it.
If the path exists, check to see whether an application is defined on the path. If an application is already defined at this metabase path and the value of MD_APP_ISOLATED does not match the value specified by the dwAppMode parameter, delete the current application (see section 3.7.4.2).
Create the new application.
Set the MD_APP_ISOLATED property on the specified metabase path to the value specified in the dwAppMode parameter.
Set the MD_APP_ROOT property on the specified metabase path to the value of szMDPath without any trailing '/' if one was specified.
If szAppPoolId is NULL and fCreatePool is FALSE, return S_OK.
If fCreatePool is TRUE, create an application pool with name szAppPoolId (see section 3.9.4.3).
If fCreatePool is FALSE and no application pool exists with the name szAppPoolId, return ERROR_NOT_FOUND.
Set the MD_APP_APPPOOL_ID property on the specified metabase path to the value of szAppPoolId.