I have a Service Reference (not a web reference) in VS2008 to a web service that I did not write. The reference works, but only asynchronous versions of each method are available for me to use.
In the "Configure Service Reference" dialog, the "Generate asynchronous operations" is checked and grayed out. First of all, I thought checking this box generated async methods in addition to, not instead of, blocking methods. Second, I've never seen it grayed out before.
I have experience writing both sides of both WCF and ASMX-era web services and have never seen this before. What could be causing this?
Thanks.
I'd be willing to wager ten up-votes that it's because you're doing this in Silverlight. Unfortunately I don't have the tools installed so I can't test this theory, but I do know that service calls from Silverlight can only be asynchronous. Perhaps you are using a Silverlight project template and are creating the service reference there? Visual Studio might be smart enough to know not to generate blocking methods in such a situation.
For reference:
http://msdn.microsoft.com/en-us/library/cc197937(VS.95).aspx
The Silverlight Plugin is running on the Browsers UI thread. If you did synchronous networking calls you would block the entire Browser UI thread. In Chrome this would result in a non-responding tab, in other browsers like IE, the entire browser would appear locked.
So by only supporting asynchronous networking you are forced to write your application in an asynchronous maner.
Silverlight only generates async service calls. However check this CodeProject page out.
When I started working with Silverlight, it was something that threw me at first. Then I realised I should be changing my code to work with the async model. You dont want to be blocking the UI thread while you wait for a service call to return.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With