please check the example below
namespace GServices { [ServiceKnownType(typeof(SearchType))] [ServiceContract(SessionMode = SessionMode.Allowed)] public interface ITest { [OperationContract] int subtract(int x, int y); } [ServiceKnownType(typeof(SearchType))] [ServiceContract(SessionMode = SessionMode.Allowed)] public interface ITest2 { [OperationContract] int add(int x, int y); } public class G : ITest2, ITest { public int add(int x, int y) { return x + y; } public int subtract(int x, int y) { return x + y; } } }
The ITest method has a subtract () method, and the Itest2 method has an add () method.
Both are implemented by one specific class G.
If I just want to expose ITest through WCF, I have the following endpoint configuration
<service name="GQS1" behaviorConfiguration="GQwcfBehaviour"> <endpoint address="DP2Svcs" binding="wsHttpContextBinding" bindingConfiguration="wsHttpEndpointBindingConfig" contract="GServices.itest"> <identity> <dns value="localhost" /> </identity> </endpoint> </service>
when I start this service and check wsdl, I see that the methods that are in itest2 also appeared in wsdl. in this case, the subtract () method should be open. But the add () method is also displayed.
My requirement is that the methods in the ITest interface should only be displayed. in this case, I want to set only the subtract () method, which is declared in ITest. But both of their implementations are in only one specific class "G". What am I missing here?
Edit: I provided my Service.svc content file:
<%@ ServiceHost Language="C#" Debug="true" Service="GServices.G" %>
source share