views:

183

answers:

4

I'm about to get started converting a C# based desktop app to be web based. For a couple of reasons, I would like to cut the GUI from the logic via a web service. Microsoft has asmx files, WCF, and probably something new at PDC next week. Data can be passed via SOAP, REST, JSON, and probably 12 other ways as well.

Could anyone suggest the .NET framework I should get started with?

+1  A: 

I vote for WCF, hands down.

JasonS
+1  A: 

If you want the option of SOAP, REST, and JSON, then you may want to look at the WCF Web Programming Model and WCF JSON support, although personally I'm not happy about the REST implementation. But WCF offers the most flexibility at the expense of configuration hell. Be sure to familiarize youself with its diagnostics and svcTraceViewer, lest you get madenning cryptic, useless exceptions. And watch out for the generated client's broken implementation of the disposable pattern.

Mark Cidade
+5  A: 

You are about to move to a new platform. I would go for WCF. It can support all your needs.

Initially when you move you can use httpBinding and that is very close to ASMX web services and is based on SOAP. If you later require some advanced features, then you can definitely utilise webHttpBinding and that will give you REST and JSON based interface. WCF is very powerful programming model and you should definitely move to it.

Pradeep
+1  A: 

For a desktop app like yours, passing data as JSON does not make a lot of sense. Its main use is to allow for easier access from a web browser. Although they serve different purposes, the same could be said for REST.

For two .NET apps communicating, WCF is the way to go, in my opinion. Though for many people ASMX more easily fits their way of thinking (just decorate something with a WebMethodAttribute and you're done) I would not recommend it because of the lack of decent authorization/authentication/encryption (pick any) and the way that its use doesn't seem to be encouraged much by Microsoft anymore.

You could also have a look at WSCF - Web Services Contract First by the way. Unfortunately, now you have even more options to choose from. :)

Frank Geerlings