0

私はWCFをまったく使用していません。新しいWCFサービスを作成しています。私は最初に1回の手術を受けました。しかし、しばらくして、さらに2つ追加することにしました。2つの新しい操作は、MicrosoftWCFテストクライアントには表示されません。問題を解決するにはどうすればよいですか?

こちらの画像

更新:最初の操作と2番目の操作をコメントアウトしました。3番目の操作は、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();
        }
    }
}
4

1 に答える 1

1

インターフェイスのすべてのメソッドのOperationContractAttribute前に追加する必要があります。

于 2013-03-26T13:32:28.553 に答える