SlideShare uma empresa Scribd logo
1 de 10
Baixar para ler offline
By LinkedIn Group: ASP.NET MVC Experts
http://www.linkedin.com/groups/ASPNET-MVC-Experts-6660700
WCF Interview Questions
1) What is the difference between WCF and ASMX Web Services?
Simple and basic difference is that ASMX or ASP.NET web service is designed to send and receive
messages using SOAP over HTTP only. While WCF can exchange messages using any format
(SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
2) What are WCF Service Endpoints? Explain.
For Windows Communication Foundation services to be consumed, it’s necessary that it must
be exposed; Clients need information about service to communicate with it. This is where
service endpoints play their role.
A WCF service endpoint has 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”. Contract identifies what is exposed by the service.
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:
1. Hosting in a Managed Application/ Self Hosting
a. Console Application
b. Windows Application
c. Windows Service
2. Hosting on Web Server
a. IIS 6.0 (ASP.NET Application supports only HTTP)
b. Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP,
NamedPipes, MSMQ.
4) 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.
5) What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly.
1. Request/Response
2. One Way
3. Duplex
Request/Response
It’s the default pattern. 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,
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 basically a 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.
6) What is DataContractSerializer and how it’s 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 that is new in .NET 3.0 and
uses opt-in approach as compared to XmlSerializer that uses opt-out. Opt-in means specify
whatever we want to serialize while Opt-out means you don’t have to specify each and every
property to serialize, specify only those you don’t want to serialize.
DataContractSerializer is about 10% faster than XmlSerializer but it has almost no control over
how the object will be serialized. If we wanted to have more control over how object should be
serialized that XmlSerializer is a better choice.
7) How we can use MessageContract partially with DataContract for a service operation in WCF?
MessageContract must be used all or none. If we are using MessageContract into an operation
signature, then we must use MessageContract as the only parameter type and as the return
type of the operation.
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 support existing clients as applications are
upgrade to WCF.
9) Please explain briefly different Instance Modes in WCF?
WCF will bind an incoming message request to a particular service instance, so the available
modes are:
Per Call: instance created for each call, most efficient in term of memory but need to maintain
session.
Per Session: Instance created for a complete session of a user. Session is maintained.
Single: Only one instance created for all clients/users and shared among all.Least efficient in
terms of memory.
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 security at the transport layer itself. When dealing
with security at Transport level, we are concerned about integrity, privacy and authentication of
message as it travels along the physical wire. It depends on the binding being used that how
WCF makes it secure because most of the 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 transport that is being used should be
secured but in 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 but we 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 WCF and ASMX Web Services?
Simple and basic difference is that ASMX or ASP.NET web service is designed to send and receive
messages using SOAP over HTTP only. While WCF can exchange messages using any format (SOAP is
default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
12) What are WCF Service Endpoints? Explain.
For Windows Communication Foundation services to be consumed, it’s necessary that it must be
exposed; Clients need information about service to communicate with it. This is where service endpoints
play their role.
A WCF service endpoint has 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". Contract identifies what is exposed by the service.
13) 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:
1. Hosting in a Managed Application/ Self Hosting
a. Console Application
b. Windows Application
c. Windows Service
2. Hosting on Web Server
a. IIS 6.0 (ASP.NET Application supports only HTTP)
b. Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP, NamedPipes, MSMQ.
14) 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.
15) What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly.
1. Request/Response 2. One Way 3. Duplex
Request/Response
It’s the default pattern. 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, 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 basically a 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.
16) 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 that is new in .NET 3.0 and uses opt-in
approach as compared to XmlSerializer that uses opt-out. Opt-in means specify whatever we want to
serialize while Opt-out means you don’t have to specify each and every property to serialize, specify
only those you don’t want to serialize. DataContractSerializer is about 10% faster than XmlSerializer but
it has almost no control over how the object will be serialized. If we wanted to have more control over
how object should be serialized that XmlSerializer is a better choice.
17) How we can use MessageContract partially with DataContract for a service operation in WCF?
MessageContract must be used all or none. If we are using MessageContract into an operation
signature, then we must use MessageContract as the only parameter type and as the return type of the
operation.
18) 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 support existing clients as applications are upgrade to WCF.
19) Please explain briefly different Instance Modes in WCF?
WCF will bind an incoming message request to a particular service instance, so the available modes are:
 Per Call: instance created for each call, most efficient in term of memory but need to maintain session.
 Per Session: Instance created for a complete session of a user. Session is maintained.
 Single: Only one instance created for all clients/users and shared among all.Least efficient in terms of
memory.
20) 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 security at the transport layer itself. When dealing with
security at Transport level, we are concerned about integrity, privacy and authentication of message as
it travels along the physical wire. It depends on the binding being used that how WCF makes it secure
because most of the bindings have built-in security.
<netTcpBinding>
<binding name="netTcpTransportBinding">
<security mode="Transport">
<Transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
b. Message Level SecurityFor Tranport level security, we actually ensure the transport that is being used
should be secured but in 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 but we can use a mixed security mode also as follows:
<basicHttpBinding>
<binding name="basicHttp">
<security mode="TransportWithMessageCredential">
<Transport />
<Message clientCredentialType="UserName" />
</security>
</binding>
</basicHttpBinding>
21) What is the proxy for WCF Service?
A proxy is a class by which a service client can Interact with the service.
By the use of proxy in the client application we are able to call the different methods exposed by
the service
22) How can we create Proxy for the WCF Service?
We can create proxy using the tool svcutil.exe after creating the service.
We can use the following command at command line.
svcutil.exe *.wsdl *.xsd /language:C# /out:SampleProxy.cs /config:app.config
23) How to test the WCF Service?
We can use the WCF Test client to test the WCF Service. Tool enables users to input test
parameters, submit that input to the service, and view the response.
We can use the following command at command line. wcfTestClient.exe URI1 URI2 …
24) What are SOAP Faults in WCF?
Common language runtime (CLR) exceptions do not flow across service boundaries. At the
maximum, a CLR exceptions may propagate up to the service tier from business components.
Unhandled CLR exceptions reach the service channel and are serialized as SOAP faults before
reporting to clients. An unhandled CLR exception will fault the service channel, taking any
existing sessions with it. That is why it is very importatnt to convert the CLR exceptions into
SOAP faults. Where possible, throw fault exceptions
25) What happens if there is an unhandled exception in WCF?
If there is an unhandled exception in WCF, the the service model returns a general SOAP fault,
that does not include any exception specific details by default. However, you can include
exception details in SOAP faults, using IncludeExceptionDetailsInFaults attribute. If
IncludeExceptionDetailsInFaults is enabled, exception details including stack trace are included
in the generated SOAP fault. IncludeExceptionDetailsInFaults should be enabled for debugging
purposes only. Sending stack trace details is risky.
26) What is InstanceContextMode in WCF?
This property value indicate when new service objects are created ? the property has three value
the default is PerSession
1. PerCall:
2. PerSession:
3. Single:
27) What is ConcurrencyMode in WCF?
This property value indicate how service supports thread? the property has three value
the default is PerSession
1. Single:
2. Multiple :
3. Reentrant
28) What is address in WCF and how many types of transport schemas are there in WCF?
Address is a way of letting client know that where a service is located. In WCF, every service is
associated with a unique address. This contains the location of the service and transport
schemas. WCF supports following transport schemas
1. HTTP
2. TCP
3. Peer network
4. IPC (Inter-Process Communication over named pipes)
5. MSMQ
The sample address for above transport schema may look like
http://localhost:81
http://localhost:81/MyService
net.tcp://localhost:82/MyService
net.pipe://localhost/MyPipeService
net.msmq://localhost/private/MyMsMqService
net.msmq://localhost/MyMsMqService

Mais conteúdo relacionado

Mais procurados

WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)ipower softwares
 
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
 
JMS Introduction
JMS IntroductionJMS Introduction
JMS IntroductionAlex Su
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCFybbest
 
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
 
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...Eyal Doron
 
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
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Peter R. Egli
 
Web services
Web servicesWeb services
Web servicesaspnet123
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & RESTSanthu Rao
 
SOAP, WSDL and UDDI
SOAP, WSDL and UDDISOAP, WSDL and UDDI
SOAP, WSDL and UDDIShahid Shaik
 
Web services in java
Web services in javaWeb services in java
Web services in javamaabujji
 

Mais procurados (20)

WCF for begineers
WCF  for begineersWCF  for begineers
WCF for begineers
 
WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)WCF (Windows Communication Foundation)
WCF (Windows Communication Foundation)
 
Windows Communication Foundation
Windows Communication FoundationWindows Communication Foundation
Windows Communication Foundation
 
Wcf
WcfWcf
Wcf
 
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
 
WCF Introduction
WCF IntroductionWCF Introduction
WCF Introduction
 
JMS Introduction
JMS IntroductionJMS Introduction
JMS Introduction
 
WCF Fundamentals
WCF Fundamentals WCF Fundamentals
WCF Fundamentals
 
Introduction to WCF
Introduction to WCFIntroduction to WCF
Introduction to WCF
 
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
 
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...
OWA client protocol connectivity flow in Exchange 2013/2007 coexistence | 3/4...
 
WCF And ASMX Web Services
WCF And ASMX Web ServicesWCF And ASMX Web Services
WCF And ASMX Web Services
 
Web Services
Web ServicesWeb Services
Web Services
 
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
 
Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)Windows Communication Foundation (WCF)
Windows Communication Foundation (WCF)
 
Web service introduction 2
Web service introduction 2Web service introduction 2
Web service introduction 2
 
Web services
Web servicesWeb services
Web services
 
A presentation on WCF & REST
A presentation on WCF & RESTA presentation on WCF & REST
A presentation on WCF & REST
 
SOAP, WSDL and UDDI
SOAP, WSDL and UDDISOAP, WSDL and UDDI
SOAP, WSDL and UDDI
 
Web services in java
Web services in javaWeb services in java
Web services in java
 

Destaque

Who's talking about your sports book brand today? iGaming Business Super Show...
Who's talking about your sports book brand today? iGaming Business Super Show...Who's talking about your sports book brand today? iGaming Business Super Show...
Who's talking about your sports book brand today? iGaming Business Super Show...Joakim Nilsson
 
Reichenau mill restoration project
Reichenau mill restoration projectReichenau mill restoration project
Reichenau mill restoration projectBlogatize.net
 
Treb housing market_charts_july_2010
Treb housing market_charts_july_2010Treb housing market_charts_july_2010
Treb housing market_charts_july_2010James Metcalfe
 
2011 marlc-socialmedia-session-1-4
2011 marlc-socialmedia-session-1-42011 marlc-socialmedia-session-1-4
2011 marlc-socialmedia-session-1-4NEA
 
Facebook - Hack the Graph
Facebook - Hack the GraphFacebook - Hack the Graph
Facebook - Hack the GraphNextAcademy
 
Individual sections development exercise #1
Individual sections development exercise #1Individual sections development exercise #1
Individual sections development exercise #1tykl94
 
Larry k - trail presentation
Larry k - trail presentationLarry k - trail presentation
Larry k - trail presentationTrailplan
 
Lcwebinar rise of-the_databrarian_73961
Lcwebinar rise of-the_databrarian_73961Lcwebinar rise of-the_databrarian_73961
Lcwebinar rise of-the_databrarian_73961Sigaard
 
Portfolio Ytze van der Sluis / Audiovisual Design, Film and Photography
Portfolio Ytze van der Sluis / Audiovisual Design, Film and PhotographyPortfolio Ytze van der Sluis / Audiovisual Design, Film and Photography
Portfolio Ytze van der Sluis / Audiovisual Design, Film and Photographyytze
 
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...Mamadigital
 
Why gold is different from other assets
Why gold is different from other assetsWhy gold is different from other assets
Why gold is different from other assetsHochleitner Marine
 
ГОС 3-го поколения
ГОС 3-го поколенияГОС 3-го поколения
ГОС 3-го поколенияfarcrys
 

Destaque (20)

Who's talking about your sports book brand today? iGaming Business Super Show...
Who's talking about your sports book brand today? iGaming Business Super Show...Who's talking about your sports book brand today? iGaming Business Super Show...
Who's talking about your sports book brand today? iGaming Business Super Show...
 
Reichenau mill restoration project
Reichenau mill restoration projectReichenau mill restoration project
Reichenau mill restoration project
 
Treb housing market_charts_july_2010
Treb housing market_charts_july_2010Treb housing market_charts_july_2010
Treb housing market_charts_july_2010
 
Brand blog
Brand blogBrand blog
Brand blog
 
2011 marlc-socialmedia-session-1-4
2011 marlc-socialmedia-session-1-42011 marlc-socialmedia-session-1-4
2011 marlc-socialmedia-session-1-4
 
Facebook - Hack the Graph
Facebook - Hack the GraphFacebook - Hack the Graph
Facebook - Hack the Graph
 
Rm 06
Rm 06Rm 06
Rm 06
 
20120113 I3A
20120113 I3A 20120113 I3A
20120113 I3A
 
report
reportreport
report
 
Individual sections development exercise #1
Individual sections development exercise #1Individual sections development exercise #1
Individual sections development exercise #1
 
Evidence
EvidenceEvidence
Evidence
 
GAMES
GAMESGAMES
GAMES
 
Larry k - trail presentation
Larry k - trail presentationLarry k - trail presentation
Larry k - trail presentation
 
Lcwebinar rise of-the_databrarian_73961
Lcwebinar rise of-the_databrarian_73961Lcwebinar rise of-the_databrarian_73961
Lcwebinar rise of-the_databrarian_73961
 
What College Graduates Should Know About Health Insurance
What College Graduates Should Know About Health InsuranceWhat College Graduates Should Know About Health Insurance
What College Graduates Should Know About Health Insurance
 
Portfolio Ytze van der Sluis / Audiovisual Design, Film and Photography
Portfolio Ytze van der Sluis / Audiovisual Design, Film and PhotographyPortfolio Ytze van der Sluis / Audiovisual Design, Film and Photography
Portfolio Ytze van der Sluis / Audiovisual Design, Film and Photography
 
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
Comunicare con i Motori di Ricerca senza essere fraintesi: alla scoperta del ...
 
Why gold is different from other assets
Why gold is different from other assetsWhy gold is different from other assets
Why gold is different from other assets
 
ГОС 3-го поколения
ГОС 3-го поколенияГОС 3-го поколения
ГОС 3-го поколения
 
Walk UNH
Walk UNHWalk UNH
Walk UNH
 

Semelhante a Wcf faq

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
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its SecurityMindfire Solutions
 
Web services Concepts
Web services ConceptsWeb services Concepts
Web services Conceptspasam suresh
 
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
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487Bat Programmer
 
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
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Storyukdpe
 
Microservices with asp dot net core, a next gen technology
Microservices with asp dot net core, a next gen technologyMicroservices with asp dot net core, a next gen technology
Microservices with asp dot net core, a next gen technologyEvincedev
 
A Message-Passing Model For Service Oriented Computing
A Message-Passing Model For Service Oriented ComputingA Message-Passing Model For Service Oriented Computing
A Message-Passing Model For Service Oriented ComputingCheryl Brown
 
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
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web servicesNeil Ghosh
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation iiSwamy Gowtham
 
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docx
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docxUnit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docx
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docxwillcoxjanay
 
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
 

Semelhante a Wcf faq (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
 
Basics of WCF and its Security
Basics of WCF and its SecurityBasics of WCF and its Security
Basics of WCF and its Security
 
Web services Concepts
Web services ConceptsWeb services Concepts
Web services Concepts
 
WCF
WCFWCF
WCF
 
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
 
1. WCF Services - Exam 70-487
1. WCF Services - Exam 70-4871. WCF Services - Exam 70-487
1. WCF Services - Exam 70-487
 
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 web services concepts
SOA web services conceptsSOA web services concepts
SOA web services concepts
 
Session 1: The SOAP Story
Session 1: The SOAP StorySession 1: The SOAP Story
Session 1: The SOAP Story
 
Microservices with asp dot net core, a next gen technology
Microservices with asp dot net core, a next gen technologyMicroservices with asp dot net core, a next gen technology
Microservices with asp dot net core, a next gen technology
 
A Message-Passing Model For Service Oriented Computing
A Message-Passing Model For Service Oriented ComputingA Message-Passing Model For Service Oriented Computing
A Message-Passing Model For Service Oriented Computing
 
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...
 
Osbsoa1
Osbsoa1Osbsoa1
Osbsoa1
 
Intro to web services
Intro to web servicesIntro to web services
Intro to web services
 
Windows communication foundation ii
Windows communication foundation iiWindows communication foundation ii
Windows communication foundation ii
 
Overview of web services
Overview of web servicesOverview of web services
Overview of web services
 
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docx
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docxUnit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docx
Unit 1 Intersystem CommunicationsCOP4858 PROGRAM & TECH ENH.docx
 
Advantage of WCF Over Web Services
Advantage of WCF Over Web ServicesAdvantage of WCF Over Web Services
Advantage of WCF Over Web Services
 

Último

Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Último (20)

Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

Wcf faq

  • 1. By LinkedIn Group: ASP.NET MVC Experts http://www.linkedin.com/groups/ASPNET-MVC-Experts-6660700
  • 2. WCF Interview Questions 1) What is the difference between WCF and ASMX Web Services? Simple and basic difference is that ASMX or ASP.NET web service is designed to send and receive messages using SOAP over HTTP only. While WCF can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc). 2) What are WCF Service Endpoints? Explain. For Windows Communication Foundation services to be consumed, it’s necessary that it must be exposed; Clients need information about service to communicate with it. This is where service endpoints play their role. A WCF service endpoint has 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”. Contract identifies what is exposed by the service. 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: 1. Hosting in a Managed Application/ Self Hosting a. Console Application b. Windows Application c. Windows Service 2. Hosting on Web Server a. IIS 6.0 (ASP.NET Application supports only HTTP) b. Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP, NamedPipes, MSMQ.
  • 3. 4) 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. 5) What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly. 1. Request/Response 2. One Way 3. Duplex Request/Response It’s the default pattern. 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, 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 basically a 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. 6) What is DataContractSerializer and how it’s different from XmlSerializer? Serialization is the process of converting an object instance to a portable and transferable
  • 4. format. So, whenever we are talking about web services, serialization is very important. Windows Communication Foundation has DataContractSerializer that is new in .NET 3.0 and uses opt-in approach as compared to XmlSerializer that uses opt-out. Opt-in means specify whatever we want to serialize while Opt-out means you don’t have to specify each and every property to serialize, specify only those you don’t want to serialize. DataContractSerializer is about 10% faster than XmlSerializer but it has almost no control over how the object will be serialized. If we wanted to have more control over how object should be serialized that XmlSerializer is a better choice. 7) How we can use MessageContract partially with DataContract for a service operation in WCF? MessageContract must be used all or none. If we are using MessageContract into an operation signature, then we must use MessageContract as the only parameter type and as the return type of the operation. 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 support existing clients as applications are upgrade to WCF. 9) Please explain briefly different Instance Modes in WCF? WCF will bind an incoming message request to a particular service instance, so the available modes are: Per Call: instance created for each call, most efficient in term of memory but need to maintain session. Per Session: Instance created for a complete session of a user. Session is maintained. Single: Only one instance created for all clients/users and shared among all.Least efficient in terms of memory. 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 security at the transport layer itself. When dealing
  • 5. with security at Transport level, we are concerned about integrity, privacy and authentication of message as it travels along the physical wire. It depends on the binding being used that how WCF makes it secure because most of the 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 transport that is being used should be secured but in 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 but we 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 WCF and ASMX Web Services? Simple and basic difference is that ASMX or ASP.NET web service is designed to send and receive messages using SOAP over HTTP only. While WCF can exchange messages using any format (SOAP is default) over any transport protocol (HTTP, TCP/IP, MSMQ, NamedPipes etc).
  • 6. 12) What are WCF Service Endpoints? Explain. For Windows Communication Foundation services to be consumed, it’s necessary that it must be exposed; Clients need information about service to communicate with it. This is where service endpoints play their role. A WCF service endpoint has 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". Contract identifies what is exposed by the service. 13) 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: 1. Hosting in a Managed Application/ Self Hosting a. Console Application b. Windows Application c. Windows Service 2. Hosting on Web Server a. IIS 6.0 (ASP.NET Application supports only HTTP) b. Windows Process Activation Service (WAS) i.e. IIS 7.0 supports HTTP, TCP, NamedPipes, MSMQ. 14) 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. 15) What Message Exchange Patterns (MEPs) supported by WCF? Explain each of them briefly. 1. Request/Response 2. One Way 3. Duplex
  • 7. Request/Response It’s the default pattern. 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, 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 basically a 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. 16) 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 that is new in .NET 3.0 and uses opt-in approach as compared to XmlSerializer that uses opt-out. Opt-in means specify whatever we want to serialize while Opt-out means you don’t have to specify each and every property to serialize, specify only those you don’t want to serialize. DataContractSerializer is about 10% faster than XmlSerializer but it has almost no control over how the object will be serialized. If we wanted to have more control over how object should be serialized that XmlSerializer is a better choice. 17) How we can use MessageContract partially with DataContract for a service operation in WCF? MessageContract must be used all or none. If we are using MessageContract into an operation signature, then we must use MessageContract as the only parameter type and as the return type of the operation. 18) 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 support existing clients as applications are upgrade to WCF. 19) Please explain briefly different Instance Modes in WCF? WCF will bind an incoming message request to a particular service instance, so the available modes are:
  • 8.  Per Call: instance created for each call, most efficient in term of memory but need to maintain session.  Per Session: Instance created for a complete session of a user. Session is maintained.  Single: Only one instance created for all clients/users and shared among all.Least efficient in terms of memory. 20) 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 security at the transport layer itself. When dealing with security at Transport level, we are concerned about integrity, privacy and authentication of message as it travels along the physical wire. It depends on the binding being used that how WCF makes it secure because most of the bindings have built-in security. <netTcpBinding> <binding name="netTcpTransportBinding"> <security mode="Transport"> <Transport clientCredentialType="Windows" /> </security> </binding> </netTcpBinding> b. Message Level SecurityFor Tranport level security, we actually ensure the transport that is being used should be secured but in 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 but we can use a mixed security mode also as follows: <basicHttpBinding> <binding name="basicHttp"> <security mode="TransportWithMessageCredential"> <Transport /> <Message clientCredentialType="UserName" /> </security> </binding> </basicHttpBinding>
  • 9. 21) What is the proxy for WCF Service? A proxy is a class by which a service client can Interact with the service. By the use of proxy in the client application we are able to call the different methods exposed by the service 22) How can we create Proxy for the WCF Service? We can create proxy using the tool svcutil.exe after creating the service. We can use the following command at command line. svcutil.exe *.wsdl *.xsd /language:C# /out:SampleProxy.cs /config:app.config 23) How to test the WCF Service? We can use the WCF Test client to test the WCF Service. Tool enables users to input test parameters, submit that input to the service, and view the response. We can use the following command at command line. wcfTestClient.exe URI1 URI2 … 24) What are SOAP Faults in WCF? Common language runtime (CLR) exceptions do not flow across service boundaries. At the maximum, a CLR exceptions may propagate up to the service tier from business components. Unhandled CLR exceptions reach the service channel and are serialized as SOAP faults before reporting to clients. An unhandled CLR exception will fault the service channel, taking any existing sessions with it. That is why it is very importatnt to convert the CLR exceptions into SOAP faults. Where possible, throw fault exceptions 25) What happens if there is an unhandled exception in WCF? If there is an unhandled exception in WCF, the the service model returns a general SOAP fault, that does not include any exception specific details by default. However, you can include exception details in SOAP faults, using IncludeExceptionDetailsInFaults attribute. If IncludeExceptionDetailsInFaults is enabled, exception details including stack trace are included in the generated SOAP fault. IncludeExceptionDetailsInFaults should be enabled for debugging purposes only. Sending stack trace details is risky. 26) What is InstanceContextMode in WCF?
  • 10. This property value indicate when new service objects are created ? the property has three value the default is PerSession 1. PerCall: 2. PerSession: 3. Single: 27) What is ConcurrencyMode in WCF? This property value indicate how service supports thread? the property has three value the default is PerSession 1. Single: 2. Multiple : 3. Reentrant 28) What is address in WCF and how many types of transport schemas are there in WCF? Address is a way of letting client know that where a service is located. In WCF, every service is associated with a unique address. This contains the location of the service and transport schemas. WCF supports following transport schemas 1. HTTP 2. TCP 3. Peer network 4. IPC (Inter-Process Communication over named pipes) 5. MSMQ The sample address for above transport schema may look like http://localhost:81 http://localhost:81/MyService net.tcp://localhost:82/MyService net.pipe://localhost/MyPipeService net.msmq://localhost/private/MyMsMqService net.msmq://localhost/MyMsMqService