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

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: 12/14/2010 7:31:21 AM
Comment:
Hi,

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

Very useful!

Thanks
Title: Thank You   
Name: Safiya P
Date: 8/12/2010 8:23:13 AM
Comment:
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: 8/6/2010 4:57:10 AM
Comment:
Thank you so much....
Title: Very useful   
Name: sudheer
Date: 4/1/2010 4:41:31 AM
Comment:
thnks a lot was very useful
Title: Very Useful article especially to the beginner   
Name: kurt
Date: 11/9/2009 2:01:20 AM
Comment:
Very Useful article especially to the beginner
Title: Very Very Good   
Name: Pankaj Lahoti
Date: 8/7/2008 5:02:54 AM
Comment:
Hai (all wcf),
Its very Clear and Understandable Steps.
hopefully find more Article near Future...10x in adv
Title: start WCF   
Name: Adrian
Date: 3/27/2008 3:19:10 PM
Comment:
very clear, thanks

Product Spotlight
Product Spotlight 





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


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 10/31/2014 7:36:19 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search