FAQS‎ > ‎

WCF (SOAP) FAQ

WCF Architecture 

Why to choose WCF as development platform

Advantage of WSE against ASMX 

  1. ASMX only support WS-Basic profile that offer limited featured and do not support advance concepts like security , federation , policy etc.
  2. ASXM only support HTTP/HTTPS protocols while WCF support many 

Advantage of WCF against ASMX

ASMX only support WS-Basic profile that offer limited featured and do not support advance concepts like federation , policy etc.

Advantage of WCF against  WSE3

WCF is further augmentation of WSE and now native part of dot net framework , it have much better abstraction of transport channels and can support multiple protocols 

Does WCF support sessions

Yes, but not all the bindings and instancing mode support it, By default session is turned on for the bindings that support it. http://www.codeproject.com/Articles/188749/WCF-Sessions-Brief-Introduction

What are reliable session and how can we configure reliable session in WCF Service.

This actually implements WS-Reliable Messaging protocols and ensures that messages will be delivered exactly once in in the order it was sent, even if connection itself is not reliable. http://msdn.microsoft.com/en-us/library/ms733136(v=vs.110).aspx

How does server capabilities (2000,2003,2008) effect WCF deployment options,

Yes it affect type of hosting options available.read more... 

How Client callback are implemented in WCF

We need to implement a call back contract with service. http://idunno.org/archive/2008/05/29/wcf-callbacks-a-beginners-guide.aspx

How we can achieve Operation Overloading while exposing WCF Services?

By default, WSDL doesn’t support operation overloading. Overloading behavior can be achieved by using “Name” property of OperationContract attribute.

[ServiceContract]
interface IMyCalculator
{
   [OperationContract(Name = "SumInt")]
   int Sum(int arg1,int arg2);
   [OperationContract(Name = "SumDouble")]
   double Sum(double arg1,double arg2);
}

When the proxy will be generated for these operations, it will have 2 methods with different names i.e. SumInt and SumDouble.

WCF Configurations

What are the different types of binding available in WCF and when to use what

Most common binding are 
  1. basicHttpBinding
  2. basicHttpContextBinding 
  3. WSHttpBinding
  4. WSHttpContextBinding
  5. WSDualHttpBinding
  6. WSFederationHttpBinding
  7. NetNamedPipeBinding
  8. NetMsmqBinding
  9. NetPeerTcpBinding 

What is the difference in between MEX and WSDL endpoint based metadata exchanges

MEX endpoints allow clients to receive the service’s metadata by using SOAP messages instead of http get requests. You can create MEX endpoint that can be accessed through http, https, tcp, and even named pipes.  The response that you will receive when calling a MEX endpoint’s GetMetadata operation will include the content of the WSDL and all the XSD files that are linked to it. http://blogs.microsoft.co.il/blogs/idof/archive/2011/08/10/wsdl-vs-mex-knockout-or-tie.aspx

How do you choose which binding to use

Choice is made based on requirements like Interoperability , Transaction requirement , Security requirement , authentication requirement ,  fadaration requirment , message delivery requirment etc. A general guildeline can be folund here http://msdn.microsoft.com/en-us/library/ms731092(v=vs.110).aspx

What are the possible ways to activate and configure  a WCF Service Instance 

  1. Inline Activation using .SVC file 
  2. Configuration Based activation using config file that also support custom implementation of service host without SVC file 
  3. Using ASP.Net routing configuration to support conditional activition without SVC file
    Read More
  1. MSDN:Configuration-Based Activation in IIS and WAS
  2. MSDN:System.Web.Routing Integration

What is the disadvantage of configuring a WCF service with .svc 

First it makes configuration flexible and if required we can creates REST like enpoints using ASP.Net routing based conditional activiations.http://msdn.microsoft.com/en-us/library/ee358760.aspx 

WCF Deployment (Hosting)

What are the deployment options available with WCF and what are there capabilities.

Self hosting, IIS, WAS, Windows service , Read More MSDN:Hosting WCF Service

What is the Advantage of hosting a service in IIS

  1. High Scalability through multiple worker process
  2. Process Recycling
  3. Automatic Process Activation
  4. Message based service activation
  5. IIS Built in Security Features like Authentication
Read more MSDN:Hosting in Internet Information Services

What are suggest best practices for deployment of WCF service under IIS 

  1. Always implement service as separate DLL 
  2. Endpoints must be configured using base address and relative URIs
  3. Do not configure your service to use non native protocols like TCP on IIS6 that is not natively supported 
  4. Though WCF provides session information but do not store state information in IIS because it may lost while app pool recycles
  5. Prefer reusing WCF Proxy instances because proxy creations are expensive operations. It also boost performance by using proxy caching feature and thread safe
  6. Prefer using Asyn client call (begin/end version) to improve middle tire performance
  7. Do not run two application under same same app pool because it causes temporary folder overwrite , always have different application running under different app pool each configured using different user ID and temporary folder settings
  8. Use asynchronous processing model in between ASP.Net runtime and WCF runtime to increase performance , this can be done via configuration files
  9. Read more  MSDN:Internet Information Services Hosting Best Practices

Can a WCF IIS deployment have multiple base address and when such configuration should be used

Yes , When we need to publish different end points to same service such as Internet and intranet version Read More.. MSDN:Supporting Multiple IIS Site Bindings

WCF Security  

Wow do we secure a WCF Service 

  1. Security WCF service has three parts , Authentication , Authorization add Message protection
  2. Authentication 
    1. For authentication either we can use built-in authentication support like windows ,basic or custom.
    2. WCF also provide support for authentication service that works leverage ASP.Net membership already configured in any other application 
  3. Authorization 
    1. Role Based , Identity based , Resource Based (Windows ACLs)
  4. Message Protection 
    1. Message Level (Certificates Digitals Signature etc), Transport Level (SSL)
  5. Impersonation
    1. Transport Level impersonation 
    2. Soap Level impersonation

WCF Transactions 

How transaction are handled in WCF

WCF provides WSAT protocol that is actually part of WS* protocol to implement transaction, it uses Lightweight or distributed transaction manager as required..G.WCF Transactions

WCF REST

How WCF REST is implemented  

It is implemented by using WebGet and WebInvoke attribute, that actually uses UriTemplateMatch class to match and invoke WCF operation.C.WCF REST