【发布时间】:2010-01-19 20:11:11
【问题描述】:
不确定我是否做错了什么......但我正在尝试实现一个可以从 WCF 调用的 WCF 服务。我在客户端实现了异步模式,调用如下所示:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
EndpointAddress endpointAddress = new EndpointAddress(AccountServiceURL);
var personService = new ChannelFactory<IAccountService>(basicHttpBinding, endpointAddress).CreateChannel();
var result = personService.BeginRegister(username, password, email, null, null);
personService.EndRegister(result); // <-- failing here
它挂在“EndRegister”调用上......它只是坐在那里,什么都不做。并且 firefox.exe 变得无响应。服务器似乎永远不会收到调用,因为我在方法调用上有一个断点。也许有人能看出我做错了什么?
合约在客户端是这样的:
[ServiceContract]
public interface IAccountService
{
[OperationContract(AsyncPattern = true)]
IAsyncResult BeginRegister(string username, string password, string email, AsyncCallback callback, Object state);
void EndRegister(IAsyncResult result);
}
并在服务器上这样:
[ServiceContract]
public interface IAccountService
{
[OperationContract]
void Register(string username, string password, string email);
}
【问题讨论】:
标签: wcf silverlight