Silverlight wcf服务-更改方法的返回值

Silverlight wcf服务-更改方法的返回值,wcf,silverlight,Wcf,Silverlight,在我的服务中,我有一个返回bool的方法,但后来我将其更改为IList,我更新了 通过右键单击服务引用并进行更新来提供服务。但是,更新没有更新方法返回值。对于这段代码,我得到一条错误消息,上面写着“无法将类型bool隐式转换为System.Collection.Generic.IList” 服务中的方法: [OperationContract] public IList<Patient> SavePatient(string personId, string firs

在我的服务中,我有一个返回bool的方法,但后来我将其更改为IList,我更新了 通过右键单击服务引用并进行更新来提供服务。但是,更新没有更新方法返回值。对于这段代码,我得到一条错误消息,上面写着“无法将类型bool隐式转换为System.Collection.Generic.IList”

服务中的方法:

    [OperationContract]
    public IList<Patient> SavePatient(string personId, string firstName, string lastName, DateTime TimeOfArrival, string causeOfVisit)
    {
        patientRepository.SavePatient(personId, firstName, lastName, TimeOfArrival, causeOfVisit);
        return patientRepository.Patients;
    }
[运营合同]
公共IList SavePatient(字符串personId、字符串firstName、字符串lastName、到达日期时间、字符串causeOfVisit)
{
patientRepository.SavePatient(人名、名、姓、到达时间、就诊原因);
返回患者阳性。患者;
}

如何解决此问题?

当您更改将布尔值返回到IList时,在进行更新服务引用之前,您是否在顶部的“构建”菜单中构建了解决方案?因为在我看来,它仍然返回bool,因为您忘记了这一步,它需要这两个步骤,一个是在服务器端(Projectname.web)进行更新,在服务器端,您通过构建解决方案和客户端定义WCF,正如您在更新服务引用时所做的那样



您使用的是启用Silverlight的WCF服务还是仅启用了WCF服务?您是否在更新服务参考之前重新启动了服务?启用Silverlight的WCF服务!重新启动?删除引用并尝试添加againI。这样做了,不起作用。在您的wcfservice patientService中,它不是像在我的注释中添加的代码那样附加到异步,然后在其完成并返回时附加另一个事件,在这一行代码中,您似乎做到了这一点,但您不应该调用savePatientSync吗?我不完全理解您的评论,但patientService是一个包含服务变量的类。savePatient方法调用client.SavePatientCompleted+=回调;savePatientSync(personId、firstName、lastName、DateTime.Now、causeOfVisit);其中客户端是服务。
    [OperationContract]
    public IList<Patient> SavePatient(string personId, string firstName, string lastName, DateTime TimeOfArrival, string causeOfVisit)
    {
        patientRepository.SavePatient(personId, firstName, lastName, TimeOfArrival, causeOfVisit);
        return patientRepository.Patients;
    }
WCFservice.TopicInfoAsync(query_topics, (int)numberOfTopics);
WCFservice.TopicInfoCompleted += (Stopicinfo, EAtopicinfo) =>
{
   TopicList = EAtopicinfo.Result;
}