简体   繁体   中英

WCF Proxy Classes … sometimes?

I have the following classes:

public abstract class BaseClass1 {}
public class ConcreteClass1 : BaseClass1 {}
public abstract class BaseClass2 : BaseClass1 {}
public class ConcreteClass2 : BaseClass2 {}

A WCF Service exposes 2 methods:

public ConcreteClass1 Method1() {...}
public ConcreteClass2 Method2() {...}

When "consuming" this WCF service with VS2012, the WCF client code correctly returns my "shared" ConcreteClass1 but for some reason, insists on generating a PROXY class for ConcreteClass2?

I don't understand why (even though I ALWAYS mark that I want to use ALL shared assemblies) sometimes it generates proxy classes for me and sometimes it does what I ask. I don't think I've ever seen it generate proxy classes for some of the types in an assembly, but not others.

I'm Totally confused!

Any help would be greatly appreciated...

I have ran into this problem as well. Sometimes turning all ALL shared assemblies off and updating the service and then turning all assemblies on and updating the service worked. Also...Picking specific assemblies was a lot less buggy. It was easier for me to write my own proxy class that way I could have it generate the code I wanted.

I found a good discussion about it here: WCF and Shared Reference Library Between Client & Service

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM