检查是否安装了 Microsoft OLE DB Provider for Index Server(又名 Provider=MSIDXS)?

Check if Microsoft OLE DB Provider for Index Server (aka Provider=MSIDXS) is installed?

我使用 Windows Server 2008 R2 和 ASP.NET 4.6.1.

如何检查 用于索引服务器的 Microsoft OLE DB 提供程序 (Provider=MSIDXS) 是否已安装?

也许可以获取系统中可用的 OLEDB 提供程序的列表。

我试试这个代码。

我现在不知道是否适用于所有 32 位和 64 位提供商

CLSID OLEDB 的 GuidC8B522D0-5CF3-11ce-ADE5-00AA0044773D

internal static Guid IID_IUnknown = new Guid("00000000-0000-0000-c000-000000000046");
internal static Guid CLSID_DataLinks = new Guid("2206CDB2-19C1-11d1-89E0-00C04FD7A829");
internal static Guid CLSID_OLEDB_ENUMERATOR = new Guid("C8B522D0-5CF3-11ce-ADE5-00AA0044773D");
internal static Guid CLSID_MSDASQL_ENUMERATOR = new Guid("C8B522CD-5CF3-11ce-ADE5-00AA0044773D");


private string GetOLEDBProvidersRegistered()
{
    var res = "";
    try
    {
        Guid guidOleDbEnum = new Guid("{C8B522D0-5CF3-11ce-ADE5-00AA0044773D}");

        Type type = Type.GetTypeFromCLSID(guidOleDbEnum);

        using (OleDbDataReader rdr = OleDbEnumerator.GetEnumerator(type))
        {
            while (rdr.Read())
                //Console.WriteLine("{0} - {1}", rdr["SOURCES_NAME"], rdr["SOURCES_DESCRIPTION"]);
                res += string.Format("{0} - {1}\r\n", rdr["SOURCES_NAME"], rdr["SOURCES_DESCRIPTION"]);

        }
    }
    catch (Exception ex)
    {
        res = ex.Message;
    }
    return res;
}