感谢Kent Boogart的回答,现在一切都正常了。非常感谢所有的回答!
你好,
我需要在WPF GUI中自主托管WCF服务。我正在使用ServiceHost。
但是我仍然无法解决问题。
首先我托管一个服务:
ServiceHost host;
Service.ISORClient service = new Service.SORClient();
//The next are in window constructor
host = new ServiceHost(service);
host.Open();
当我按下按钮时,我希望刷新数据,因此:
dataGrid1.ItemsSource = service.GetPatients();
它能够工作,但只有一次。如果我尝试刷新超过一次,它就无法正常工作。
这是我的WCF服务声明:
[ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
public class SORClient : ISORClient
... and all the methods come here...
奇怪的是,当我从客户端应用程序连接时,我可以获取所有数据,一切都正确。但是我无法将数据传输到GUI中(好吧,我只能获取一次)。
非常感谢您提前的帮助!
GetPatients()
方法中添加断点,并确保在从WPF
客户端调用时它被命中了? - decyclone