0
我在WCF中頗爲新穎。我正在創建一個新的WCF服務。我最初有1次手術。但過了一段時間,我決定再添加兩個。這兩個新操作不會出現在Microsoft WCF測試客戶端中。我該如何解決我的問題?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();
}
}
}
(我可能會因爲工作中的網絡設置而看不到圖像。)您是否使用'[OperationContract]'屬性註釋缺少的服務方法?所有的方法都是在服務'interface'中定義的嗎? – 2013-03-26 13:25:47
我更新了我的代碼。請看一下。 :) 我相信我已經完成了上述所述。 – 2013-03-26 13:29:57