次の方法で共有


IISComputer::Backup

The Backup method backs up the metabase to a location you specify by providing a backup location name of up to 100 characters in length. Multiple metabase backups can be stored in a backup location.

HRESULT Backup(
  BSTR  bstrLocation,
  LONG  lVersion,
  LONG  lFlags
);

Parameters

  • bstrLocation
    [in] String containing the location. If an empty string is specified, the default backup location will be used. IIS determines the backup storage mechanism, so the backup location name you provide does not necessarily translate to a particular directory, file, or database storage mechanism. Metabase backups are stored as files in the system32\inetsrv\MetaBack directory.

  • lVersion
    [in] Long integer containing the version number to be assigned to the backup. Must be less than or equal to MD_BACKUP_MAX_VERSION (9999). Can be set to MD_BACKUP_NEXT_VERSION (0xffffffff) which automatically selects the next available version number. These constants are defined in the Mddefw.h header file.

  • lFlags
    [in] Long integer containing one or more of the following flags.

    • MD_BACKUP_FORCE_BACKUP (0x00000004) forces the backup to proceed even if the save fails. Only valid if MD_BACKUP_SAVE_FIRST is specified.

    • MD_BACKUP_OVERWRITE (0x00000001) backs up the metabase even if a backup with the same name and version already exists, overwriting the existing files.

    • MD_BACKUP_SAVE_FIRST (0x00000002) saves the metabase prior to making the backup. Specify MD_BACKUP_FORCE_BACKUP if you want the backup to proceed even if the save fails.

    These constants are defined in the Mddefw.h header file.

Return Value

Returns an HRESULT that contains one of the values listed in the following table. The errors that begin with "MD_" are owned by IIS and are defined in the Mdmsg.h header file. Other errors can also be returned that are passed through from the file system, or from the CryptoAPI when secure metabase data is being saved.

Term

Definition

E_INVALIDARG

An argument was invalid.

HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY)

Insufficient memory to perform the operation.

S_OK

The method succeeded.

MD_WARNING_SAVE_FAILED

This is a warning, not an error (0x000CC809L).

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS

Header: Declared in iiisext.h; include iisext_i.c.

See Also

Concepts

IIS ADSI Provider Interfaces

Using ADSI to Configure IIS in a C++ Application

IIS Constants and Header Files

IISComputer2 Interface

IMSAdminBase

IMSAdminBase2