Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 WCF 服务。我在 WCF 服务中添加了一个 DLL 的引用。现在 ddl 有一个类,我可以通过使用 serviceknowntypeattribute 而不是类中的函数来访问 WCF 客户端的类。任何解决方案?
我猜您正在使用自动生成的代码(通过在 Visual Studio 中添加服务引用)。这会为您的类创建一个存根(仅是一个容器),但它实际上不是您的类。要在客户端代码中使用您的实际类,您必须在客户端项目和服务引用高级选项中引用它,确保您已选中“使用引用程序集中的类型”。