不知道我是否做錯了什麼......但我試圖實現可以從WCF調用的WCF服務。我實現了客戶端上的異步模式,這裏的電話是什麼樣子:從Silverlight掛起的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);
}
就是這樣!謝謝傑森 – 2009-12-15 00:55:36