views:

116

answers:

1

I'm building a few small prototypes in Silverlight and have quite a bit of .NET experience, but Ive never had the need to contact the server from Silverlight.

Im really just after a really quick solution for the purposes of prototyping and I'll be needing to call the server and do a few things, like serve a generated image from the server using post data, receive basic responses from the server, but nothing too fancy.

Is .NET RIA Services the best way to do this or is it overkill?

The documentation for RIA Services is huge, 1 hour long video introductions, 26-part series blogs, etc... seems like its overkill.

Is there a quick REST based project I could create, or should RIA services be the way to go?

+1  A: 

If you want to just do basic HTTP you can use the WebClient class to GET and POST data. If you need more control over the requests you can use HttpWebRequest but this is somewhat of a pain if you don't need the extra control.

There are some features of WCF that allow you to create services that are easily callable by HTTP clients but this is not it's main goal.

If your server operations are very simple (or are already implemented as REST/HTTP) I would stick with that and use WebClient or HttpWebRequest. But if you want the convenience of client-side proxy classes that are used more like method calls, I would use the WCF infrastructure but WCF RIA services is probably not all that necessary.

Unless... you are working on a line of business application that uses things like validation rules, data binding, CRUD operations, etc.

Josh Einstein
thanks for the info, so far I have made a basic ashx handler for serving the image (just writing the images bytes to the outputstream) and setting the URL of the `Image` tag to be the URL of the handler (with some querystring parameters) which seems to work as well.
Mark
If you just want to load a dynamic image into the Image control that is the simplest option, yes. I'm not sure if Silverlight still has this problem but in Silverlight 4 beta I noticed that if you loaded a bunch of Image elements and got a 404 or some other error, CPU utilization would spike. I worked around it by hooking up the ImageFailed event and set the Source to null.
Josh Einstein
thanks for the advice :)
Mark