Reference Methods Exposed in Web Service RRS feed

  • Question

  • User-1990028391 posted

    I have a web service developed in C# that uses a class library containing strongly typed datasets.  When a client application has references to the web service and the dataset class library, all the properties and methods of the dataset class library are exposed by the web service as well as through the reference to the dataset class library.

    This causes "an ambiguous reference" error between the web service and the dataset class library.

    Does a web service expose all of the properties and methods of all assemblies it references?  And, it there any way to prevent this?

    Thanks, Tom

    Friday, August 9, 2013 10:01 AM


  • User-1662538993 posted

    Are you using asmx service or wcf service?

    For asmx service which methods you want to expose you have to add [WebMethod] attribute.

    For wcf service you can add methods you want to expose [OperationContract] and define in interface [OperationContract] and then implement in the class that implement the interface.

    If you will not put [webmethod] or [operationcontract] attribute then that method won't expose.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 9, 2013 4:01 PM