I recently managed to get a WCF service running in IIS. I created a simple console application to test this. I did click the option to generate the asynch calls, and when I create an instance of my service client, I have [FunctionName]Asynch methods and [FunctionName]Completed event handlers.
The problem is that the event handlers never fire. I set them up and put break points inside them. The break points never fire though. I know the initial asynch method is called, but no completion.
The service is in IIS and has been added to my project as a service reference.
Here’s the code on the client side, although the problem is probably not there:
clt.SubmitEvalCompleted += (o, e) => {
var sender = o as EvalServiceClient;
Console.WriteLine("Submit completed");
sender.GetEvalsAsync();
};
clt.GetEvalsCompleted += (o, e) => {
var listOfEvals = e.Result;
foreach (var eval in listOfEvals)
{
Console.WriteLine("Eval: " + eval.ID + " comments: " + eval.Comments);
}
};
Eval evale = new Eval { Comments = "Comment", Submitter = "Me" };
clt.SubmitEval( evale );
clt.GetEvals();
Thanks for reading!
The events will only be called if you call the asynchronous version of the method (SubmitEvalAsync, GetEvalsAsync). If you call the synchronous version, you’ll get the result right away.