Home Async/Await in WCF Operation
Reply: 0

Async/Await in WCF Operation

shifter
1#
shifter Published in 2014-08-07 07:20:15Z

I'm currently making our WCF services asynchronous, this WCF service will be called from PHP on the client side and I know that there is a way to call services from PHP asynchronously, but is it good practice to have the following code in my WCF project?

[ServiceContract]
public interface IEmployeeService
{
    [OperationContract]
    Task<List<string>> GetEmployeeUsernames();
}

public class Employee : IEmployeeService
{
    public async Task<List<string>> GetEmployeeUsernames()
    {
        // some logic here...
        using (WebResponse response = await wr.GetResponseAsync())
        {
             // some logic here...
        }
    }
}

I was reading about task-based implementation of WCF but when I removed/changed all our existing methods in our WCF project with async methods Visual Studio did not allow it when I tried to run and debug.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.359111 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO