0

I am quite new in WCF. I am creating a new WCF service. I initially had 1 operation. But after some time I decided to add two more. The 2 new operations doesn't appear in the Microsoft WCF test client. How do I resolve my problem?

Image here

Update : I commented out my first operation and second operation. The third operation got updated in the WCF test client.

Image here

@ Jen

 namespace MyService
    {
        // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
        [ServiceContract]
        public interface IService1
        {
            [OperationContract]
            List<User> FindUser(string userName, string password);
            List<Service> GetServiceList();
            List<Message> GetMessageList(string userName);
        }
    }




namespace MyService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
    public class Service1 : IService1
    {
        public List<Service> GetServiceList()
        {
            DataClasses1DataContext context = new DataClasses1DataContext();
            var res = from r in context.Services select r;
            return res.ToList();
        }

        public List<User> FindUser(string userName, string password)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();
            var res = from r in context.Users where r.UserName == userName && r.Password == password select r;
            return res.ToList();
        }

        public List<Message> GetMessageList(string userName)
        {
            DataClasses1DataContext context = new DataClasses1DataContext();
            var res = from r in context.Messages where r.ReceiverID == userName select r;
            return res.ToList();
        }
    }
}
Lawrence Wong
  • 1,129
  • 4
  • 24
  • 40
  • (I may be missing something because I do not see the images due to network setup at work.) Did you annotate the missing service method with the `[OperationContract]` attribute? Are all methods defined in the service `interface`? – Jens H Mar 26 '13 at 13:25
  • I updated my codes above. Please take a look. :) I believe I have done the above as mentioned. – Lawrence Wong Mar 26 '13 at 13:29

1 Answers1

1

You need to add OperationContractAttribute before every method in Your interface.

Grzegorz W
  • 3,487
  • 1
  • 21
  • 21