Операции службы тестового клиента WCF не обновляются

Я совсем новичок в WCF. Я создаю новую службу WCF. Сначала мне сделали 1 операцию. Но через некоторое время я решил добавить еще два. Две новые операции не отображаются в тестовом клиенте Microsoft WCF. Как решить мою проблему?

Изображение здесь

Обновление: я прокомментировал свою первую операцию и вторую операцию. Третья операция была обновлена ​​в тестовом клиенте WCF.

Изображение здесь

@ Джен

 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();
        }
    }
}

person Lawrence Wong    schedule 26.03.2013    source источник
comment
(Возможно, я что-то упустил, потому что не вижу изображений из-за настройки сети на работе.) Вы аннотировали отсутствующий метод службы атрибутом [OperationContract]? Все ли методы определены в службе interface?   -  person Jens H    schedule 26.03.2013
comment
Я обновил свои коды выше. Взгляни, пожалуйста. :) Я считаю, что сделал выше, как уже упоминалось.   -  person Lawrence Wong    schedule 26.03.2013


Ответы (1)


Вам нужно добавить OperationContractAttribute перед каждым методом в Вашем интерфейсе.

person Grzegorz W    schedule 26.03.2013