Klay
Klay

Reputation: 2011

choosing the right WCF web service option

I'm just starting out with WCF web services, and I'm having a really hard time finding a very simple tutorial, so I thought I'd ask some questions here.

Here's my setup: I have a WPF desktop application that needs to send data over the internet to a web service on our server.

The way I see it, I have at least these four options:

  1. I can do New Website --> WCF Service
  2. or New Project --> WCF Service Application
  3. or I can add a project to my existing WPF desktop app solution for a WCF Service Application
  4. or I can add a project for a WCF Service Library

Can anyone tell me which is the best choice, and then maybe point to a tutorial to help me get started along that route?

Upvotes: 2

Views: 1212

Answers (3)

Klay
Klay

Reputation: 2011

I managed to finally find a very clear start-to-finish tutorial on propping up a WCF web service here. I set everything up according to the tutorial, and so far it works very well. Hopefully there won't be any problems later with deployment or maintenance--guess we'll see.

Incidentally, it uses the New Web Site --> WCF Service template which other posters here have explicitly said not to use. I don't mean to sound contentious, but it seems to work me.

Upvotes: 0

blowdart
blowdart

Reputation: 56500

This is all rather subjective of course

  1. WCF Service Website - I avoid anything to do with New Websites. They're nasty horrible things, which don't build the way I want and assume everything in a directory belongs to them. There were masses of complaints when MS took away web applications, and they eventually were returned. I'd always recommend avoiding.
  2. A WCF service application creates a new solution with a WCF service application in it. (see 3.)
  3. This adds a new service application. This contains everything a WCF service needs to run, on a web including a sample SVC file, a sample contract and some preplumbed configuration settings.
  4. This is the bare bones, with no hosting application at all, just a sample config, a sample contract and a sample implementation. If you run this it hosts it in the WCF test server.

If you already have a solution for your desktop application then I'd suggest you add a new WCF service application project to your solution and keep everything in one place. You can also set Visual Studio to run both applications when debugging, so you can actually check everything works together.

If you were writing a separate set of services, to be used by multiple client programmes which all exist in separate solutions I'd have option 2, and then option 4 when you want more flexibility such as hosting the services in a command line application or windows service.

Upvotes: 2

Andrew Hare
Andrew Hare

Reputation: 351516

Here is a good (if not a bit dated) "hello world" WCF tutorial: Windows Communication Foundation (Indigo) Hello World Tutorial:

This first tutorial will look at installing WCF (as part of the .net Framework 3.0), including the Visual Studio 2005 integration, and producing a first simple "Hello World" service to demonstrate some of the key concepts of the platform. The samples are all in C#, but I can spin off VB.Net equivalents if there is sufficient interest. Also, previous versions of this series (that targeted various pre-release versions of WCF) used Notepad and the command line to build and compile WCF services. This latest version makes use of Visual Studio because, especially with the RTM release, I suspect that is what most readers will be using. If you're interested in crafting your services by hand to explore the underpinnings of WCF more closely (or to obtain the asynchronous implementation, as you will see further down), let me know and I'll update the earlier samples. So, with that all covered, let's get to installing and using WCF!

Upvotes: 0

Related Questions