简体   繁体   中英

WCF Async only operation

I have a client that use both async and sync method from a WCF service.

I don't see any good reason to keep some sync call. Since I can with Task call async method within a sync one.

And it's better to not block UI when I call my service.

So I'm currently trying to remove every sync call. First is it a good pratice in WCF? If not why?

And second I use svcutils to generate my files. I have both sync and async call.

The project is big and to remove sync call the easiest way is to generate only async call with svcutils. So with compile error I will be able to only keep async easily.

But I can't find any option on svcutils that disable the sync method generation.

Any way to do so?

In case if it is UI application it is better to use only async methods, as you said - to not block UI during calls.

Regarding svcutil.exe, it can't create only async methods and ignore sync's. You can use /async parameter, but it will create all as async, which does not work for you. Means, better to delete synchronous methods manually first.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM