You are on page 1of 9

WCF Difference FAQs-1 Difference between basicHttpBinding and wsHttpBinding Criteria Security support BasicHttpBinding This supports the

old ASMX style, i.e. WS-BasicProfile 1.1. WsHttpBinding

This exposes web services using WS-* specifications. Compatibilit This is aimed for clients who do As its built using WS-* y not have .NET 3.0 installed and specifications, it it does not support wider ranges of supports wider ranges of clients. client Many of the clients like and it cannot be consumed by older Windows .NET version less than 3 version. 2000 still do not run .NET 3.0. So older version of .NET can consume this service. Soap SOAP 1.1 SOAP 1.2 and WS-Addressing version specification. Reliable messaging Not supported. In other words, if Supported as it supports WS-* a client fires two or three calls specifications. you really do not know if they will return back in the same order. By default, there is no security provided for messages when the client calls happen. In other words, data is sent as plain text. None Windows default authentication Basic Certificate As WsHttBinding supports WS-*, it has WS-Security enabled by default. So the data is not sent in plain text. None Transport Message Transport with message credentials

Default security options

Security options

Difference between Message and Transport level security in WCF Criteria Scenarios when we should be using one of them Transport Security When there are no intermediate systems in between this is the best methodology. If its an intranet type of solution this is most Message Security When there are intermediate systems like one more WCF service through which message is routed then message security is the way to go.

recommended methodology. Advantages Does not need any extra coding as protocol inherent security is used. Performance is better as we can use hardware accelerators to enhance performance. There is lot of interoperability support and communicating clients do not need to understand WS security as its built in the protocol itself. Disadvantages As its a protocol implemented security so it works only point to point. Needs application refactoring to implement security. Provides end to end security as its not dependent on protocol. Any intermediate hop in network does not affect the application. Supports wide set of security options as it is not dependent on protocol. We can also implement custom security.

As every message is encrypted As security is dependent on and signed there are performance protocol it has limited security issues. support and is bounded to the protocol security limitations. Does not support interoperability with old ASMX webservices Difference between Buffered transfer and Streamed transfer in WCF S.No 1 2 3 Buffered Transfer Target can process the message once it is completely received. Performance will be good when message size is small Native channel shape is IDuplexSessionChannel Streamed Transfer Target can start processing the data when it is partially received. Performance will be good when message size is larger(more than 64K) Native channels are IRequestChannel and IReplyChannel

Difference between WCF and Web Services

S.No 1

Features Hosting

WebService It can be hosted in IIS

WCF t can be hosted in IIS, windows activation service, Self-hosting, Windows

service 2 Programming [WebService] attribute has to be added to the class [WebMethod] attribute represents the method exposed to client One-way, RequestResponse are the different operations supported in web service System.Xml.serialization name space is used for serialization [ServiceContract] attribute has to be added to the class [OperationContract] attribute represents the method exposed to client One-Way, RequestResponse, Duplex are different type of operations supported in WCF System.Runtime.Serialization namespace is used for serialization

Model

Operation

XML

Encoding

XML 1.0, XML 1.0, MTOM, Binary, MTOM(Message Custom Transmission Optimization Mechanism), DIME, Custom Can be accessed through HTTP, TCP, Custom Security Web Services are stateless Can be accessed through HTTP, TCP, Named pipes, MSMQ,P2P, Custom Security, Reliable messaging, Transactions WCF Services can manage states

Transports

8 9

Protocols State Management

Reference: http://onlydifferencefaqs.blogspot.in/2012/07/wcf-difference-faqs-1.html WCF Difference FAQs-2 1.Difference between Self Hosting and IIS Hosting S.No 1 Self Hosting Coding Effort: We need to add some extra code to host the process 2 Deployment: Easy to deploy IIS Hosting Coding Effort: No need to add extra code Automatic hosting Deployment: More difficult to deploy than Self-

Hosting 3 Recycling: Recycling: process recycling is

Automatic process recycling is Automatic not possible possible 4 Service Lifetime:

Service Lifetime: be controlled

Can control the service lifetime Lifetime cannot using Open and Close manually. methods 5 Host Process: Host Process:

Host process should be IIS host runs automatically when a running before client makes a client makes a call to the service. call to the service. 2.Difference between Behaviour and Contract (OR) Difference between Service Behaviour and Service Contract S.No 1 Service Contract Behaviour: Service Behaviour Behaviour:

Affects the behavior of both Only affects the behavior of the client and server server 2 Applicability: Applicability: to a class

Can apply to both interface Only applicable and class implementation 3 Impact on WSDL: Affects the WSDL emitted Impact on WSDL:

Does not affect the WSDL

3.Difference between proxy and channel factory S.No 1 Proxy Channel Factory

Only requires URL where the We must have direct access to the service resides assembly that contains that service contract T for Very simpler Easy to understand Not easier Channels are complex, networkrelated

2 3 4

There is Visual Studio gives us When we share a common service

add the reference

contract dll between the client and the server, we will be using the ChannelFactory class

Proxies have restrictions like:

several If we know that our entities will not change much and the client code is less, then a DLL would work better 1. Properties need to have than a proxy gets and sets 2. Contructors cannot be exposed 3. Methods other than the service contract cannot be exposed

By using SVCutil.exe we will When we are using DLL that refers create Proxy Service contract interface then use the channel factory class

4.Difference between DataContractSerializer and XMLSerializer S.No 1 DataContractSerializer A practical benefit of the design of the DataContractSerializer is better performance over Xmlserializer. This is because DataContratSerializer explicitly shows the which fields or properties are serialized into XML. XMLSerializer XMLSerializer does not provide better performance when compare with DataContratSerializer because XMLSerializer does not indicate which fields or properties of the type are serialized into XML

The DataContractSerializer XMLSerializer cannot translate the can translate the HashTable HashTable into XML. into XML. DataContractSerializer is XMLSerializer is used for complex basically for very small, simple schemas. subset of the XML infoset. DataContractSerializer serializes private members. DataContractSerializer uses the opts-in approach i.e, selecting the members that needs to be serialized .This is called as opts-in approach. DataContractSerializer XmlSerializer cannot private members serialize

4 5

XmlSerializer uses opts-out approach i.e., marking the members do not need to be serialized. This is called as optsout approach.

can XmlSerializer can serialize only

serialize both public types.

private

and public types. If we are trying to serialize a class that is marked private by InvalidOperation Exception will be thrown by the serializer.

DataContractSerializer does For any types that needs to be not need any default serialized by XmlSerializer must constructor before serializing have a default constructor. any type. DataContractSerializer does not give more control over the generated xml structure compared to the XmlSerializer. XmlSerializer gives more control over the generated xml structure compared to the DataContractSerializer. For ex, if a field should come as an attribute or element.

DataContractSerializer can XmlSerializer cannot able to able to serialize types that serialize types that implements implements Idictionary. IDictionary, for ex. Dictionary type cannot be serialized. We can serialize a type that marked with [Serializable] attribute with DataContractSerializer. It serializes all the members (private, public) even they are marked with [XmlIgnore]. WCF DataContractSerializer attribute Only the public members are serialized not the private members. Suppose we do not need any of the member to be serialized we can use [XmlIgnore] attribute

10

11

uses Webservice attribute

uses

XMLSerializer

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/wcf-difference-faqs-2.html WCF Difference FAQs-3 1.Difference between WCF Data Services and WCF RIA Services S.No 1 WCF Data Services Supported Clients: WCF RIA Services Supported Clients:

Resource-based API, supports Domain-based API, most tailored all clients via deep REST and for use with Silverlight, but OData support. supports other clients via SOAP, JSON, and OData. 2 Supported Data Access Supported Data Access Layers :

Layers : Supports EF, LINQ to SQL, and Targets EF. Other DALs are POCO (custom persistence layer). supported, but greater effort is required. 3 Client Development : Client Development :

Requires you to notify the Supports self-tracking entities, context for change tracking. synchronized client/server logic, and much more (particularly with Silverlight). 4 Service Development : Service Development :

Instant, code-less, extensible Requires you to code CRUD REST services out of the box operations manually in domain (with EF); free CRUD. service classes. Another good reference: http://silverlighttime.blogspot.in/2011/04/what-is-difference-between-wcf-data.html 2.Difference between Close and Abort in WCF Channels S.No 1 2 Close Abort

Close performs graceful Abort shut downs Client channel shutdown of Client Channel immediately. Close waits for in progress Abort ends in progress calls. calls to complete before closing Close should not be called in Abort should be called in faulted faulted channels as it can channels. throw Communication or Timeout exception

3.Difference between ASMX and SVC S.No 1 2 ASMX SVC

Web service class inheritance There is no Web service class for ASMX is called WebService inheritance for SVC. In ASMX,Web service class In SVC,Web service class attribute attribute is called as is called as WebServiceAttribute. ServiceContractAttribute. In ASMX,Web service method In SVC,Web service method attribute is called as attribute is called as WebMethodAttribute. OperationContractAttribute.

4 5

In ASMX,Data class attribute is In SVC,Data class attribute is called as XmlRootAttribute called as DataContractAttribute. In ASMX,Data class attribute is called XmlElementAttribute field In SVC,Data class field attribute is as called as DataMemberAttribute.

6 7

In ASMX,HTTP endpoint In SVC,HTTP endpoint resource is resource is called as .ASMX. called as .SVC In ASMX, Serialization attribute In SVC, Serialization attribute is is called as XMLSerializer called as DataContractSerializer attribute. attribute.

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/wcf-difference-faqs-3.html Difference between reliable messaging and reliable sessions in WCF Difference between reliable messaging and reliable sessions in WCF S.No 1 Reliable messaging Reliable messaging is concerned with ensuring that messages are delivered exactly once. Reliable sessions Reliable session provides a context for sending and receiving a series of reliable messages.

Summary: Reliable sessions have a dependency on reliable messaging. We have to use reliable messaging to provide an end-to-end reliable session between a client application and a service. So finally, both are different but related concepts. Reference: http://onlydifferencefaqs.blogspot.in/2012/08/difference-between-reliablemessaging.html Differences between a regular WCF Services and a Silverlight-Enabled WCF Services Differences between a regular WCF Services and a Silverlight-Enabled WCF Services S.No 1 WCF Service Utilizes the wsHttpBinding as its default binding Are generated with an Silverlight-Enabled WCF Service Utilizes basicHttpBinding as its default binding

Have no interface generated when they are

Interface

created and the following is added to the class [AspNetCompatibilityRequirements(Requirements Mode = AspNetCompatibilityRequirementsMode.Allowed)] the following element is added to the

Reference: http://onlydifferencefaqs.blogspot.in/2012/08/differences-between-regularwcf.html asp.net vs wcf session Difference between asp.net and wcf session S.No 1 2 ASP.NET Session WCF Session

ASP.NET sessions are initiated WCF sessions are initiated by by server only. WCF Client. ASP.NET sessions data can be In WCF, session Messages accessed in unordered way. delivered during a session are processed in the order in which they are received. ASP.NET has a general data In WCF, there is no such data storage mechanism for session storage mechanism available for session.

Reference: http://onlydifferencefaqs.blogspot.in/2012/09/difference-between-aspnet-andwcf.html

You might also like