WFC Service Not Seeing Operation Contract

I am having a weird problem where I have a wcf service that has some Operation Contracts but when I add the service reference to another project they are there.

When I go to add -> add service reference. I put in the wfc url and the service shows up.

When I look at the operations list I see those endpoints but when I hit "ok" and then I try to find those endpoints in my project they are not found.

How can I go about debugging this?

3 answers

  • answered 2021-03-08 22:10 Gabriel Manzini

    Make sure you are using the correct Data Anotations on your interface, for example:

    [ServiceContract]
        public interface IService1
        {
    
            [OperationContract]
            [FaultContract(typeof(ExceptionMessage))]
            List<student> GetStudents();
    
            [OperationContract]
            [FaultContract(typeof(ExceptionMessage))]
            void AddStudents(Student student);
    
            [OperationContract]
            [FaultContract(typeof(ExceptionMessage))]
            void DeleteStudent(long StudentId); 
        }
    

  • answered 2021-03-08 22:16 Adil Deveci

    You must have a [Service Contract] interface. And it should contain your methods

  • answered 2021-03-09 02:21 Ding Peng

    When you successfully add the service reference, the proxy class will be automatically generated in the project:

    enter image description here

    And it will automatically generate web.config, web.config contains endpoint information:

    enter image description here