提供用于将配置设置传递给提供程序的接口。
语法
interface IFtpProviderConstruct : IUknown
方法
下表列出了 接口公开 IFtpRoleProvider 的方法。
| 名称 | 定义 |
|---|---|
| IFtpProviderConstruct::Construct 方法 | 从 IIS ApplicationHost.config 文件中 FTP 提供程序的配置设置中检索键/值对数组。 |
备注
可以通过添加 <activation> 集合来指定 IIS ApplicationHost.config 文件中 FTP 提供程序的参数,该集合可能包含一系列 <providerData> 元素,这些元素列出了自定义 FTP 提供程序的其他设置。 每个 <providerData> 元素与集合中的 <providerDefinitions> 一个条目配对,并包含一系列键/值对,其中包含特定于每个提供程序的信息。
以下配置摘录说明了 ApplicationHost.config 文件中的自定义 FTP 提供程序条目及其相关信息。
<system.ftpServer>
<providerDefinitions>
<add name="FtpDemo"
clsid="FtpDemo.DemoProvider" />
<activation>
<providerData name="FtpDemo">
<add key="one" value="1" />
<add key="two" value="2" />
</providerData>
</activation>
</providerDefinitions>
</system.ftpServer>
示例
下面的代码示例循环访问配置设置的数组,并将键/值对发送到调试流。
public:
STDMETHOD(Construct)(SAFEARRAY * configurationEntries)
{
CONFIGURATION_ENTRY * pArray;
HRESULT hr = S_OK;
LONG lLbound = 0;
LONG lUbound = 0;
OutputDebugString(L"IFtpProviderConstruct::Construct\n");
// Retrieve the upper and lower bounds for the configuration array.
SafeArrayGetLBound( configurationEntries, 1, &lLbound );
SafeArrayGetUBound( configurationEntries, 1, &lUbound );
// Retrieve a pointer to the array of configuration settings.
hr = SafeArrayAccessData(configurationEntries, (void**)&pArray);
// Return an error if a failure occurs.
if (FAILED(hr))
{
return hr;
}
// Loop through the array of configuration setttings and
// output the key/value pairs to the debug channel.
for(LONG Index = lLbound; Index <= lUbound; Index ++)
{
OutputDebugString(pArray[Index].bstrKey);
OutputDebugString(pArray[Index].bstrValue);
}
// Release the pointer to the array of configuration settings.
hr = SafeArrayUnaccessData(configurationEntries);
// Return an error if a failure occurs.
if (FAILED(hr))
{
return hr;
}
return S_OK;
}
要求
| 类型 | 说明 |
|---|---|
| 客户端 | - Windows 7 上的 IIS 7.5 - Windows 8 上的 IIS 8.0 - Windows 10 上的 IIS 10.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 |
| 参考 | ftpext.tlb |