我正在尝试使用 c# 和 ASP.NET 使用 COM+。我一直在关注一个例子,但是它的一部分失败了。
dynamic oCatalog = Activator.CreateInstance(Type.GetTypeFromProgID("ComAdmin.COMAdminCatalog"));
/* Get the Applications collection and populate it */
dynamic applicationInstances = oCatalog.GetCollection("Applications");
applicationInstances.Populate();
foreach (dynamic applicationInstance in applicationInstances)
{
Response.Write("<p>" + applicationInstance.Name.ToString() + "-" + applicationInstance.Key.ToString() + "</p>");
dynamic objComponents = oCatalog.GetCollection("Components", applicationInstance.Key);
objComponents.Populate();
foreach(dynamic Components in objComponents)
{
Response.Write("<p>" + Components.Name.ToString() + "</p>");
}
}
当上述调用 oCatalog.GetCollection("Components", applicationInstance.Key) 被调用时,我收到错误:
System.Reflection.TargetParameterCountException:调用 GetCollection 时出错。
如何获取应用程序实例中当前组件的列表?