SlideShare a Scribd company logo
1 of 12
1. What is the difference between WCF and ASMX Web Services?
Simple and basic difference is thatASMX or ASP.NET web service is designed to send and receive messages using
SOAP over HTTP only. While WCF can exchange messages using anyformat(SOAP is default) over any transport
protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
You can follow another tutorial WCF Vs ASMX for detailed discussion on this topic.
2. What are WCF Service Endpoints? Explain.
For Windows Communication Foundation services to be consumed,it’s necessarythat it mustbe exposed;Clients
need information aboutservice to communicate with it. This is where service endpoints playtheir role. Clientuses
endpointto communicate with WCF Service. A WCF service endpointhas three basic elements i.e.Address,Binding
and Contract
 Address: It defines “WHERE”. Address is the URL that identifies the location of the service.
 Binding: It defines “HOW”. Binding defines how the service can be accessed.
 Contract: It defines “WHAT”. Contractidentifies whatis exposed by the service.
A WCF Service can have multiple endpoints configured to accommodate differentclients,for example,one client may
be using HTTP while other configured to communicate over TCP.
3. What are the possible ways of hosting a WCF service? Explain.
For a Windows Communication Foundation service to host,we need at least a managed process, a ServiceHost
instance and an Endpoint configured. Possible approaches for hosting a service are:
 Hosting in a Managed Application/ Self Hosting
 Console Application
 Windows Application
 Windows Service
 Hosting on Web Server
 IIS 6.0 (ASP.NET Application supports onlyHTTP)
 Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP,TCP,
NamedPipes,MSMQ.
If you are looking for implementation ofall Hosting options,please follow here (Console | Windows Service | IIS |
WAS)
4. How we can achieve Operation Overloading while exposing WCF Services?
By default, WSDL doesn’tsupportoperation overloading.Overloading behavior can be achieved by using “Name”
property of OperationContractattribute.
[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,itwill have 2 methods with differentnames i.e.SumIntand
SumDouble.
Important Note: Remember thatduring a technical Interview,interviewer always ask aboutthe latest feature of that
particular technology, so be prepare for it also.For latest features series on Windows Communication Foundation
v4.5, Click here.
5. What Message Exchange Patterns (MEPs) supported by WCF? Explain each of
them briefly.
Windows Communication Foundation supports the following Message Exchange Patterns (MEPs):
 Request/Response
 One Way
 Duplex
Request/Response
It’s the defaultpattern. In this pattern, a response message will always be generated to consumer when the operation
is called, even with the void return type. In this scenario (void return type), response will have empty SOAP body.
One Way
In some cases,we are interested to send a message to service in order to execute certain business functionality but
not interested in receiving anything back. OneWay MEP will work in such scenarios. If we want queued message
delivery, OneWay is the only available option.
Duplex
The Duplex MEP is basicallya two-way message channel.In some cases, we want to send a message to service to
initiate some longer-running processing and require a notification back from service in order to confirm that the
requested process has been completed.
Please follow for detailed implementation for Message Exchange Patterns in WCF here.
6. What is DataContractSerializer and How its different from XmlSerializer?
Serialization is the process of converting an object instance to a portable and transferable format. So, whenever we
are talking about web services, serialization is very important.
Windows Communication Foundation has DataContractSerializer thatis new in .NET 3.0 and uses opt-in approach
as compared to XmlSerializer that uses opt-out.Opt-in means specifywhatever we want to serialize while Opt-out
means you don’thave to specify each and every property to serialize,specifyonly those you don’t wantto serialize.
DataContractSerializer is about10% faster than XmlSerializer but it has almostno control over how the objectwill be
serialized.If we wanted to have more control over how objectshould be serialized thatXmlSerializer is a better
choice.
7. What are Contracts in WCF?
A Contract is basicallyan agreementbetween the two parties i.e.Service and Client.In WCF, Contracts can be
categorized as behavioral or structural.
1. Behavioral Contractsdefinethatwhatoperationsclientcanperform on a service.
 ServiceContract attribute is used to mark a type as Service contract that contains operations.
 OperationContract attributes is used to mark the operations thatwill be exposed.
 Fault Contract defines whaterrors are raised by the service being exposed.
2. Structural Contracts
 DataContract attribute define types that will be moved between the parties.
 MessageContract attribute define the structure of SOAP message.
8. Which standard binding could be used for a service that was designed to
replace an existing ASMX web service?
The basicHttpBinding standard binding is designed to expose a service as if it is an ASMX/ASP.NET web service.
This will enable us to supportexisting clients as applications are upgrade to WCF.
9. Please explain briefly different Instance Modes in WCF?
WCF will bind an incoming message requestto a particular service instance,so the available modes are:
 Per Call: instance created for each call,mostefficientin term of memorybutneed to maintain session.
 Per Session: Instance created for a complete session ofa user.Session is maintained.
 Single: Only one instance createdfor all clients/users and sharedamong all.Least efficient in terms
of memory
Please follow “3 techniques for Instance Managementin WCF“.
10. Please explain different modes of security in WCF? Or Explain the difference
between Transport and Message Level Security.
In Windows Communication Foundation,we can configure to use security at different levels
a. Transport Level security means providing securityat the transportlayer itself. When dealing with security at
Transportlevel, we are concerned aboutintegrity, privacy and authentication ofmessage as ittravels along the
physical wire.It depends on the binding being used thathow WCF makes itsecure because mostofthe bindings
have built-in security.
<netTcpBinding>
<binding name=”netTcpTransportBinding”>
<security mode=”Transport”>
<Transport clientCredentialType=”Windows” />
</security>
</binding>
</netTcpBinding>
b. Message Level Security
For Tranport level security, we actually ensure the transportthat is being used should be secured butin message
level security, we actually secure the message.We encrypt the message before transporting it.
<wsHttpBinding>
<binding name=”wsHttpMessageBinding”>
<security mode=”Message”>
<Message clientCredentialType=”UserName” />
</security>
</binding>
</wsHttpBinding>
It totally depends upon the requirements butwe can use a mixed security mode also as follows:
<basicHttpBinding>
<binding name=”basicHttp”>
<security mode=”TransportWithMessageCredential”>
<Transport />
<Message clientCredentialType=”UserName” />
</security>
</binding>
</basicHttpBinding>
11. What is the difference between Service EndPoint and Client Endpoint?
As we already understood the conceptof an Endpointand it’s ABC (Address,Binding,Contract).Both Service and
ClientEndpointhas same ABC but we think in different perspective while working with them.We can differentiate
between Service and ClientEndpointwith respectto Address,Binding and Contractas:
Service Endpoint Client Endpoint
WHERE: URL of hosted service.
WHERE: where to connect with hosted
service.
WHAT: bindings being used. WHAT: binding supported by service.
CONTRACT: Service Contract i.e.
interfaces
CONTRACT: what to pass and expect
while communicating with service.
12. What is a WCF Binding? How many different types of bindings available in WCF?
Bindings in WCF actually defines thathow to communicate with the service. Binding specifies thatwhat
communication protocol as well as encoding method will be used.Optionally,binding can specify other important
factors like transactions,reliable sessions and security.
Another WCF Tutorial gives more detailed understanding ofBinding conceptin WCF.
There are different built-in bindings available in WCF,each designed to fulfill som e specific need.
 basicHttpBinding
 wsHttpBinding
 netNamedPipeBinding
 netTcpBinding
 netPeerTcpBinding
 netmsmqBinding
13. More WCF Interview Questions for Experienced
How can we use ServiceMetadataContractBehavior class in WCF?
ServiceMetadataContractBehavior is a class thatfacilitates us to specifywhether endpointshould be exposed in
service metadata or not. As we already know that a WCF Service can have multiple endpoints,so in certain
scenarios we mightnotbe interested to publish metadata for a specific endpointofour WCF service.
How we can use MessageContract partially with DataContract for a service
operation in WCF?
MessageContractmustbe used all or none. If we are using MessageContractinto an operation signature ,then we
mustuse MessageContractas the only parameter type and as the return type of the operation.
14. What is WCF throttling?
WCF throttling enables us to regulate the maximum number ofWCF instances,concurrentcalls and concurrent
sessions.Basic purpose is to control our WCF service performance by using Service throttling behavior. Above given
values are the defaultones,but we can update it after looking into the requirements ofour application.
In configuration file we can set this behavior as follows:
<serviceBehavior>
<behavior name=”MyServiceBehavior”>
<serviceThrottling
maxConcurrentInstances=”2147483647”
maxConcurrentCalls=”16″
maxConcurrentSessions=”10″
</behavior>
</serviceBehavior>
15. What are the core security concepts supported by WCF?
There are four core security Features
 Confidentiality: It’s a confirmation aboutthe recipient. Only the valid recipientcan read the message when
it passed between service and client.
 Integrity: is to ensure that message received is notbeing tempered or changed during exchange.
 Authentication: is a way for the parties (sender and receiver) to identify each other.
 Authorization: ensures thatwhatactions an authenticated user can perform?
16. Difference between Message Level securityand Transport Level security?
Security can be configured at two different levels in Windows Communication Foundation:
1. Transport Level Security
secures the transport (the pipe) over which the message passes through from client to a service.
2. Message Level Security
secures the message that is being transported from one end to another.
WCF Supports following Transfer Security Modes:
 None – No security at all. Very risky to choose. (nguy hiểm)
 Transport – Securing message transfer with transport protocol like TCP, IPs, HTTPs, MSMQ. It’s
Ideal for Intranet scenarios having point to point communication. (Bảo vệ truyền thông với giao thức
vận chuyển giống như TCP, IP, HTTPS, MSMQ. Đó là lý tưởng cho các kịch bản Intranet có giao
tiếp point to point)
 Message – Securing message by encrypting it. Good for scenarios even when multiple
intermediaries involved. (bảo vệ tin nhắn bằng cách mã hóa message)
 Mixed – TransportWithMessageCredential uses transport for message privacy and service
authentication with client authentication handled at message level. (sử dụng phương tiện giao
thông để bảo mật tin nhắn và xác thực với dịch vụ xác thực khách hàng được xử lý ở mức độ tin
nhắn.)
 Both -Using both Message as well as transport security. In this case a secured encrypted message
travel over a secure transport (pipe) only supported by MSMQ Binding. (sử dụng cả message và
transport)
<wsHttpBinding>
<binding name=”SecurityModeDemo”>
<security mode=”[None|Transport|Message|….]”/>
</binding>
</wsHttpBinding>
17. Can you please explain which security mode supported by various WCF Bindings?
Following table illustrates in details about support for security mode in Windows Communication
Foundation for various WCF Bindings.
WCF Binding None Transport Message Mixed Both
BasicHttpBinding Default Yes Yes Yes No
WSHttpBinding Yes Yes Default Yes No
WSDualHttpBinding Yes No Default Yes No
NetTcpBinding Yes Default Yes Yes No
NetNamedPipeBinding Yes Default No No No
NetMsmqBinding Yes Default Yes No Yes
18. What is the difference between wsdl & mex endpoint?
It's pretty the same thing but mex is designed to support non-HTTP protocols and for advanced
configuration/security scenarios. WSDL is the legacy way and MEX is the new improved version with
WCF.
19. What is the meaning of httpGetEnabled="false" or httpGetEnabled="true"
It will expose metadata via wsdl through the defautl url, even if you don't have defined a mex endpoint for
your service.

More Related Content

What's hot

10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCFBarry Dorrans
 
introduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationintroduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationredaxe12
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Jason Townsend, MBA
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overviewArbind Tiwari
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
Service Oriented Development With Windows Communication Foundation   Tulsa DnugService Oriented Development With Windows Communication Foundation   Tulsa Dnug
Service Oriented Development With Windows Communication Foundation Tulsa DnugJason Townsend, MBA
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewJorgen Thelin
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Jason Townsend, MBA
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFCode Mastery
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Saltmarch Media
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its SecurityMindfire Solutions
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceSj Lim
 

What's hot (20)

10 Tricks and Tips for WCF
10 Tricks and Tips for WCF10 Tricks and Tips for WCF
10 Tricks and Tips for WCF
 
introduction to Windows Comunication Foundation
introduction to Windows Comunication Foundationintroduction to Windows Comunication Foundation
introduction to Windows Comunication Foundation
 
Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003Service Oriented Development With Windows Communication Foundation 2003
Service Oriented Development With Windows Communication Foundation 2003
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 
Wcf architecture overview
Wcf architecture overviewWcf architecture overview
Wcf architecture overview
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
WCF
WCFWCF
WCF
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
Service Oriented Development With Windows Communication Foundation   Tulsa DnugService Oriented Development With Windows Communication Foundation   Tulsa Dnug
Service Oriented Development With Windows Communication Foundation Tulsa Dnug
 
Interoperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) OverviewInteroperability and Windows Communication Foundation (WCF) Overview
Interoperability and Windows Communication Foundation (WCF) Overview
 
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
Tulsa Tech Fest2008 Service Oriented Development With Windows Communication F...
 
WCF
WCFWCF
WCF
 
Session 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCFSession 1 Shanon Richards-Exposing Data Using WCF
Session 1 Shanon Richards-Exposing Data Using WCF
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0Building RESTful Services with WCF 4.0
Building RESTful Services with WCF 4.0
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
Windows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) ServiceWindows Communication Foundation (WCF) Service
Windows Communication Foundation (WCF) Service
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
 

Similar to WCF vs ASMX Web Services

WCF tutorial
WCF tutorialWCF tutorial
WCF tutorialAbhi Arya
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Subodh Pushpak
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication FoundationMahmoud Tolba
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaJignesh Aakoliya
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)Prashanth Shivakumar
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web ServicesSiva Tharun Kola
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Abdul Khan
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
Wcf and its features
Wcf and its featuresWcf and its features
Wcf and its featuresGulshan Sam
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Jorgen Thelin
 
Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...butest
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONDeepika Chaudhary
 

Similar to WCF vs ASMX Web Services (20)

WCF tutorial
WCF tutorialWCF tutorial
WCF tutorial
 
Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35Dot Net Training Wcf Dot Net35
Dot Net Training Wcf Dot Net35
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Understanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company indiaUnderstanding Web Services by software outsourcing company india
Understanding Web Services by software outsourcing company india
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)WCF (Windows Communication Foundation_Unit_01)
WCF (Windows Communication Foundation_Unit_01)
 
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUIAdvancio, Inc. Academy: Web Sevices, WCF & SOAPUI
Advancio, Inc. Academy: Web Sevices, WCF & SOAPUI
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
 
Web services
Web servicesWeb services
Web services
 
Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...Complete Architecture and Development Guide To Windows Communication Foundati...
Complete Architecture and Development Guide To Windows Communication Foundati...
 
SOA & WCF
SOA & WCFSOA & WCF
SOA & WCF
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
Wcf and its features
Wcf and its featuresWcf and its features
Wcf and its features
 
Day6
Day6Day6
Day6
 
Asp.net questions
Asp.net questionsAsp.net questions
Asp.net questions
 
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
Overview of Windows Vista Devices and Windows Communication Foundation (WCF)
 
Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...Dealing with Diversity: Understanding WCF Communication Options in ...
Dealing with Diversity: Understanding WCF Communication Options in ...
 
WINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATIONWINDOWS COMMUNICATION FOUNDATION
WINDOWS COMMUNICATION FOUNDATION
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
 
07 advanced topics
07 advanced topics07 advanced topics
07 advanced topics
 

Recently uploaded

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 

Recently uploaded (20)

EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 

WCF vs ASMX Web Services

  • 1. 1. What is the difference between WCF and ASMX Web Services? Simple and basic difference is thatASMX or ASP.NET web service is designed to send and receive messages using SOAP over HTTP only. While WCF can exchange messages using anyformat(SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc). You can follow another tutorial WCF Vs ASMX for detailed discussion on this topic. 2. What are WCF Service Endpoints? Explain. For Windows Communication Foundation services to be consumed,it’s necessarythat it mustbe exposed;Clients need information aboutservice to communicate with it. This is where service endpoints playtheir role. Clientuses endpointto communicate with WCF Service. A WCF service endpointhas three basic elements i.e.Address,Binding and Contract
  • 2.  Address: It defines “WHERE”. Address is the URL that identifies the location of the service.  Binding: It defines “HOW”. Binding defines how the service can be accessed.  Contract: It defines “WHAT”. Contractidentifies whatis exposed by the service. A WCF Service can have multiple endpoints configured to accommodate differentclients,for example,one client may be using HTTP while other configured to communicate over TCP. 3. What are the possible ways of hosting a WCF service? Explain. For a Windows Communication Foundation service to host,we need at least a managed process, a ServiceHost instance and an Endpoint configured. Possible approaches for hosting a service are:  Hosting in a Managed Application/ Self Hosting  Console Application  Windows Application  Windows Service  Hosting on Web Server  IIS 6.0 (ASP.NET Application supports onlyHTTP)  Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP,TCP, NamedPipes,MSMQ. If you are looking for implementation ofall Hosting options,please follow here (Console | Windows Service | IIS | WAS) 4. How we can achieve Operation Overloading while exposing WCF Services? By default, WSDL doesn’tsupportoperation overloading.Overloading behavior can be achieved by using “Name” property of OperationContractattribute. [ServiceContract] interface IMyCalculator { [OperationContract(Name = “SumInt”)] int Sum(int arg1,int arg2); [OperationContract(Name = “SumDouble”)]
  • 3. double Sum(double arg1,double arg2); } When the proxy will be generated for these operations,itwill have 2 methods with differentnames i.e.SumIntand SumDouble. Important Note: Remember thatduring a technical Interview,interviewer always ask aboutthe latest feature of that particular technology, so be prepare for it also.For latest features series on Windows Communication Foundation v4.5, Click here. 5. What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly. Windows Communication Foundation supports the following Message Exchange Patterns (MEPs):  Request/Response  One Way  Duplex Request/Response It’s the defaultpattern. In this pattern, a response message will always be generated to consumer when the operation is called, even with the void return type. In this scenario (void return type), response will have empty SOAP body.
  • 4. One Way In some cases,we are interested to send a message to service in order to execute certain business functionality but not interested in receiving anything back. OneWay MEP will work in such scenarios. If we want queued message delivery, OneWay is the only available option. Duplex The Duplex MEP is basicallya two-way message channel.In some cases, we want to send a message to service to initiate some longer-running processing and require a notification back from service in order to confirm that the requested process has been completed.
  • 5. Please follow for detailed implementation for Message Exchange Patterns in WCF here. 6. What is DataContractSerializer and How its different from XmlSerializer? Serialization is the process of converting an object instance to a portable and transferable format. So, whenever we are talking about web services, serialization is very important. Windows Communication Foundation has DataContractSerializer thatis new in .NET 3.0 and uses opt-in approach as compared to XmlSerializer that uses opt-out.Opt-in means specifywhatever we want to serialize while Opt-out means you don’thave to specify each and every property to serialize,specifyonly those you don’t wantto serialize. DataContractSerializer is about10% faster than XmlSerializer but it has almostno control over how the objectwill be serialized.If we wanted to have more control over how objectshould be serialized thatXmlSerializer is a better choice.
  • 6. 7. What are Contracts in WCF? A Contract is basicallyan agreementbetween the two parties i.e.Service and Client.In WCF, Contracts can be categorized as behavioral or structural. 1. Behavioral Contractsdefinethatwhatoperationsclientcanperform on a service.  ServiceContract attribute is used to mark a type as Service contract that contains operations.  OperationContract attributes is used to mark the operations thatwill be exposed.  Fault Contract defines whaterrors are raised by the service being exposed. 2. Structural Contracts  DataContract attribute define types that will be moved between the parties.  MessageContract attribute define the structure of SOAP message. 8. Which standard binding could be used for a service that was designed to replace an existing ASMX web service? The basicHttpBinding standard binding is designed to expose a service as if it is an ASMX/ASP.NET web service. This will enable us to supportexisting clients as applications are upgrade to WCF. 9. Please explain briefly different Instance Modes in WCF? WCF will bind an incoming message requestto a particular service instance,so the available modes are:  Per Call: instance created for each call,mostefficientin term of memorybutneed to maintain session.  Per Session: Instance created for a complete session ofa user.Session is maintained.  Single: Only one instance createdfor all clients/users and sharedamong all.Least efficient in terms of memory Please follow “3 techniques for Instance Managementin WCF“.
  • 7. 10. Please explain different modes of security in WCF? Or Explain the difference between Transport and Message Level Security. In Windows Communication Foundation,we can configure to use security at different levels a. Transport Level security means providing securityat the transportlayer itself. When dealing with security at Transportlevel, we are concerned aboutintegrity, privacy and authentication ofmessage as ittravels along the physical wire.It depends on the binding being used thathow WCF makes itsecure because mostofthe bindings have built-in security. <netTcpBinding> <binding name=”netTcpTransportBinding”> <security mode=”Transport”> <Transport clientCredentialType=”Windows” /> </security> </binding> </netTcpBinding> b. Message Level Security For Tranport level security, we actually ensure the transportthat is being used should be secured butin message level security, we actually secure the message.We encrypt the message before transporting it. <wsHttpBinding> <binding name=”wsHttpMessageBinding”> <security mode=”Message”> <Message clientCredentialType=”UserName” /> </security> </binding> </wsHttpBinding> It totally depends upon the requirements butwe can use a mixed security mode also as follows: <basicHttpBinding> <binding name=”basicHttp”> <security mode=”TransportWithMessageCredential”> <Transport /> <Message clientCredentialType=”UserName” /> </security> </binding> </basicHttpBinding>
  • 8. 11. What is the difference between Service EndPoint and Client Endpoint? As we already understood the conceptof an Endpointand it’s ABC (Address,Binding,Contract).Both Service and ClientEndpointhas same ABC but we think in different perspective while working with them.We can differentiate between Service and ClientEndpointwith respectto Address,Binding and Contractas: Service Endpoint Client Endpoint WHERE: URL of hosted service. WHERE: where to connect with hosted service. WHAT: bindings being used. WHAT: binding supported by service. CONTRACT: Service Contract i.e. interfaces CONTRACT: what to pass and expect while communicating with service. 12. What is a WCF Binding? How many different types of bindings available in WCF? Bindings in WCF actually defines thathow to communicate with the service. Binding specifies thatwhat communication protocol as well as encoding method will be used.Optionally,binding can specify other important factors like transactions,reliable sessions and security. Another WCF Tutorial gives more detailed understanding ofBinding conceptin WCF. There are different built-in bindings available in WCF,each designed to fulfill som e specific need.  basicHttpBinding  wsHttpBinding  netNamedPipeBinding  netTcpBinding  netPeerTcpBinding  netmsmqBinding
  • 9. 13. More WCF Interview Questions for Experienced How can we use ServiceMetadataContractBehavior class in WCF? ServiceMetadataContractBehavior is a class thatfacilitates us to specifywhether endpointshould be exposed in service metadata or not. As we already know that a WCF Service can have multiple endpoints,so in certain scenarios we mightnotbe interested to publish metadata for a specific endpointofour WCF service. How we can use MessageContract partially with DataContract for a service operation in WCF?
  • 10. MessageContractmustbe used all or none. If we are using MessageContractinto an operation signature ,then we mustuse MessageContractas the only parameter type and as the return type of the operation. 14. What is WCF throttling? WCF throttling enables us to regulate the maximum number ofWCF instances,concurrentcalls and concurrent sessions.Basic purpose is to control our WCF service performance by using Service throttling behavior. Above given values are the defaultones,but we can update it after looking into the requirements ofour application. In configuration file we can set this behavior as follows: <serviceBehavior> <behavior name=”MyServiceBehavior”> <serviceThrottling maxConcurrentInstances=”2147483647” maxConcurrentCalls=”16″ maxConcurrentSessions=”10″ </behavior> </serviceBehavior> 15. What are the core security concepts supported by WCF? There are four core security Features
  • 11.  Confidentiality: It’s a confirmation aboutthe recipient. Only the valid recipientcan read the message when it passed between service and client.  Integrity: is to ensure that message received is notbeing tempered or changed during exchange.  Authentication: is a way for the parties (sender and receiver) to identify each other.  Authorization: ensures thatwhatactions an authenticated user can perform? 16. Difference between Message Level securityand Transport Level security? Security can be configured at two different levels in Windows Communication Foundation: 1. Transport Level Security secures the transport (the pipe) over which the message passes through from client to a service. 2. Message Level Security secures the message that is being transported from one end to another. WCF Supports following Transfer Security Modes:  None – No security at all. Very risky to choose. (nguy hiểm)  Transport – Securing message transfer with transport protocol like TCP, IPs, HTTPs, MSMQ. It’s Ideal for Intranet scenarios having point to point communication. (Bảo vệ truyền thông với giao thức vận chuyển giống như TCP, IP, HTTPS, MSMQ. Đó là lý tưởng cho các kịch bản Intranet có giao tiếp point to point)  Message – Securing message by encrypting it. Good for scenarios even when multiple intermediaries involved. (bảo vệ tin nhắn bằng cách mã hóa message)  Mixed – TransportWithMessageCredential uses transport for message privacy and service authentication with client authentication handled at message level. (sử dụng phương tiện giao thông để bảo mật tin nhắn và xác thực với dịch vụ xác thực khách hàng được xử lý ở mức độ tin nhắn.)  Both -Using both Message as well as transport security. In this case a secured encrypted message travel over a secure transport (pipe) only supported by MSMQ Binding. (sử dụng cả message và transport) <wsHttpBinding> <binding name=”SecurityModeDemo”> <security mode=”[None|Transport|Message|….]”/> </binding> </wsHttpBinding> 17. Can you please explain which security mode supported by various WCF Bindings?
  • 12. Following table illustrates in details about support for security mode in Windows Communication Foundation for various WCF Bindings. WCF Binding None Transport Message Mixed Both BasicHttpBinding Default Yes Yes Yes No WSHttpBinding Yes Yes Default Yes No WSDualHttpBinding Yes No Default Yes No NetTcpBinding Yes Default Yes Yes No NetNamedPipeBinding Yes Default No No No NetMsmqBinding Yes Default Yes No Yes 18. What is the difference between wsdl & mex endpoint? It's pretty the same thing but mex is designed to support non-HTTP protocols and for advanced configuration/security scenarios. WSDL is the legacy way and MEX is the new improved version with WCF. 19. What is the meaning of httpGetEnabled="false" or httpGetEnabled="true" It will expose metadata via wsdl through the defautl url, even if you don't have defined a mex endpoint for your service.