將組態區段新增至目前的組態位置。
語法
HRESULT AddConfigSection(
[in] BSTR bstrSectionName,
[out,
retval] IAppHostElement** ppAdminElement
);
參數
bstrSectionName
BSTR,其中包含要加入的區段名稱。
ppAdminElement
IAppHostElement介面指標的指標。
傳回值
HRESULT。 可能的值包括 (但不限於) 下表中的這些值。
| 值 | 描述 |
|---|---|
| S_OK | 表示作業成功。 |
| ERROR_ALREADY_EXISTS | 指出組態區段已經存在 |
| ERROR_INVALID_DATA | 表示資料無效。 |
備註
設定位置可讓 IIS 7 組態系統根據位置所代表的內容路徑自訂設定。 例如,您可能想要為每個網站設定組 system.webServer/asp 態區段。 在此情況下,您會從 ApplicationHost.config組態系統檔案中的預設位置移除組態區段。 若要啟用網站的組態區段,您會在網站的組態位置下新增組態區段。
規格需求
| 類型 | 描述 |
|---|---|
| Client | - Windows Vista 上的 IIS 7.0 - Windows 7 上的 IIS 7.5 - Windows 8 上的 IIS 8.0 - Windows 10上的 IIS 10.0 |
| 伺服器 | - Windows Server 2008 上的 IIS 7.0 - Windows Server 2008 R2 上的 IIS 7.5 - Windows Server 2012 上的 IIS 8.0 - Windows Server 2012 R2 上的 IIS 8.5 - Windows Server 2016上的 IIS 10.0 |
| 產品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 - IIS Express 7.5、IIS Express 8.0、IIS Express 10.0 |
| 標頭 | Ahadmin.h |