类型库导出器遇到了派生自泛型 class 的类型
Type library exporter encountered a type that derives from a generic class
我想调用作为通用 class 实现的 WCF 服务。
注意:[我完全无权修改它的 classes 以将其标记为 COM 可见或使其成为非通用 class 等]。
我已经编写了一个使用该 WCF 服务的客户端。我得到警告:
"Type library exporter warning processing 'WCFService.MultiService.LokUpServiceClient, WCFService'. Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute".
问题:
完美消费 WCF 服务,让 WCF 客户端 COM 可见?
如何摆脱这个警告信息?
在添加服务引用时,请尝试取消选择重用现有类型选项。
+1 已接受的答案。我只想补充一点,如果您已经配置了服务引用,则可以更改服务引用的重用类型...设置,如下所示:
- 在解决方案资源管理器中,找到服务引用。它应该出现在 Connected Services 或 Web Services 部分下。
- 右键单击服务引用并单击配置服务引用。出现设置对话框。
- 清除在引用程序集中重用类型复选框。
- 单击确定。
我想调用作为通用 class 实现的 WCF 服务。 注意:[我完全无权修改它的 classes 以将其标记为 COM 可见或使其成为非通用 class 等]。
我已经编写了一个使用该 WCF 服务的客户端。我得到警告:
"Type library exporter warning processing 'WCFService.MultiService.LokUpServiceClient, WCFService'. Warning: Type library exporter encountered a type that derives from a generic class and is not marked as [ClassInterface(ClassInterfaceType.None)]. Class interfaces cannot be exposed for such types. Consider marking the type with [ClassInterface(ClassInterfaceType.None)] and exposing an explicit interface as the default interface to COM using the ComDefaultInterface attribute".
问题:
完美消费 WCF 服务,让 WCF 客户端 COM 可见?
如何摆脱这个警告信息?
在添加服务引用时,请尝试取消选择重用现有类型选项。
+1 已接受的答案。我只想补充一点,如果您已经配置了服务引用,则可以更改服务引用的重用类型...设置,如下所示:
- 在解决方案资源管理器中,找到服务引用。它应该出现在 Connected Services 或 Web Services 部分下。
- 右键单击服务引用并单击配置服务引用。出现设置对话框。
- 清除在引用程序集中重用类型复选框。
- 单击确定。