Start Development with Windows Communication Foundation
page 2 of 6
by Keyvan Nayyeri
Average Rating: 
Views (Total / Last 10 Days): 33893/ 39

Development Process

Developing a WCF service (regarding its distributed service oriented nature) consists of three general steps that you will see in a moment. Each step may have some smaller steps for its own.  Based on the approach you follow and your needs for your application, it is possible to exclude one of these small steps.  However, main steps are constant.

·         Developing the Service

·         Developing the Client (or Clients)

·         Deployment

Let us see more details about these three steps.

Developing the Service

Here is where we provide all means to give necessary services to clients.  Usually we deploy one instance of a service to be used by as many clients that need this service.  Developing a good service depends on our understanding about some principles that I talked about before.  Choosing the best configurations to set up our channels, endpoints and providing our services is the main job that we need to do here.

A service can be hosted in Internet Information Services (IIS) or can have its own logic for hosting.  In the first case we do not need to care about starting or stopping a service and IIS does this automatically for us (so needs less code), but things are not as easy as this forever and sometimes we need to write self-hosted services.  Thankfully, this is possible and needs some extra code.

In addition to having a good Service Oriented Architecture for our application to build our service on its top, we need to choose the best choice for messaging pattern, contracts, schemas, security, etc. and this is not possible without practicing and writing different services.

There are three approaches in WCF development process:

·         Code First: In this approach you implement the service code logic then generate metadata information for your service.

·         Contract First: In the second approach you write your metadata information then begin writing service or client code because here their order does not matter and both of them follow this metadata information.

·         Contractless: In this third approach (which is less common) you get down to a lower level and work directly with messages and ignore contracts.

In the first and second approaches (Code First and Contract First) you can speed up your process by using a handy code generator tool that comes with .NET Framework 3.0 and is named SvcUtil.  SvcUtil helps you to work with metadata information easier.  You know working with XSD and WSDL is not easy and SvcUtil comes to help you in this way.  SvcUtil does three jobs for developers:

·         Generates WSDL and XSD metadata from the service assembly.

·         Generates proxy code for the client from service metadata from MEX endpoint.

·         Generates proxy code for the client from service metadata from WSDL and XSD.

Note that some services are self describing.  It means that you can provide MEX endpoints for a service and in this case you do not need to generate any code using SvcUtil.  Metadata information will be generated for service automatically.

You can run "SvcUtil /?" command from command line for more information about SvcUtil.

After choosing your approach to write service logic and contract, you can go to the next step to host your service on IIS or write your own code for self-hosting and configure your service based on your needs.

After configuration you can move to the client side and start writing your client using the proxy code that you have gotten from SvcUtil and your own configurations (created manually) or configurations that are generated by SvcUtil.  After this your application will be ready.

Do not worry!  We will see an example to demonstrate these theories.

View Entire Article

User Comments

Title: Good Article for all   
Name: Balu
Date: 2010-12-14 7:31:21 AM

This article is very clear in concepts and implementations. This can be easily understandable for beginners also.

Very useful!

Title: Thank You   
Name: Safiya P
Date: 2010-08-12 8:23:13 AM
Keep posting arcles like this on new technologies. As a beginer, your articles really helped me to get the foundation. Thank You.
Title: Very useful for beginners   
Name: Elizabeth
Date: 2010-08-06 4:57:10 AM
Thank you so much....
Title: Very useful   
Name: sudheer
Date: 2010-04-01 4:41:31 AM
thnks a lot was very useful
Title: Very Useful article especially to the beginner   
Name: kurt
Date: 2009-11-09 2:01:20 AM
Very Useful article especially to the beginner
Title: Very Very Good   
Name: Pankaj Lahoti
Date: 2008-08-07 5:02:54 AM
Hai (all wcf),
Its very Clear and Understandable Steps.
hopefully find more Article near Future...10x in adv
Title: start WCF   
Name: Adrian
Date: 2008-03-27 3:19:10 PM
very clear, thanks

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-15 6:06:47 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search