Generate asynchronous operations is checked and disabled in Service Reference Dialog
March 24, 2011
Posted by on
I have observed that from a sliver light client, Visual studio doesn’t allow creation of Synchronous WCF services.
When I tried to use the service reference dialog from a Silver light client, I was shown the following
Here we can see Generate asynchronous operations is grayed out and always checked.
This appeared to be that Visual Studio always recommends the use of Asynchronous operations.
I further tried by creating the synchronous operations through SvcUtil.exe
wsdl /out:GreetingServiceProxy.cs /l:cs /config:app.config
But the runtime threw the following exception.
The contract ‘IGreetingService’ contains synchronous operations, which are not supported in Silverlight. Split the operations into "Begin" and "End" parts and set the AsyncPattern property on the OperationContractAttribute to ‘true’. Note that you do not have to make the same change on the server.
So it is evident that Silverlight supports only asynchronous web service calls.
Refer to How to: Access a Service from Silverlight and Why does my service reference only generate asynchronous methods? for more detail.