What is WCF?
WCF stands for Windows Communication Foundation (WCF) and is considered as the Microsoft Service-Oriented Architecture (SOA) platform for building distributed and interoperable applications. WCF unifies ASMX, Remoting, and Enterprise Services stacks and provides a single programming model. WCF services are interoperable and supports all the core Web services standards. WCF services also provide extension points to quickly adapt to new protocols and updates and integrates very easily with the earlier microsoft technologies like Enterprise Services, COM and MSMQ.
Showing posts with label wcf. Show all posts
Showing posts with label wcf. Show all posts
What is WSDL?
What is the role of WSDL in WCF?
WSDL stands for Web Service Description Language. The WCF service exposes the WSDL document for the clients, to generate proxies and the configuration file. The WSDL file provides the following information for the consumers of the WCF service.
1. Provides the information about the service contract and operations available.
2. Provides the information about all the end points exposed by the WCF service.
3. Provides the information about the messages and types that can be exchanged between the client and the WCF service.
4. WSDL also provides any information about the policies used.
WSDL stands for Web Service Description Language. The WCF service exposes the WSDL document for the clients, to generate proxies and the configuration file. The WSDL file provides the following information for the consumers of the WCF service.
1. Provides the information about the service contract and operations available.
2. Provides the information about all the end points exposed by the WCF service.
3. Provides the information about the messages and types that can be exchanged between the client and the WCF service.
4. WSDL also provides any information about the policies used.
3 things WCF Services must have
What are the 3 things that a WCF Services end point must have?
Address - The address where the WCF Service is hosted.
Binding - The binding that decides the protocol, message encoding and security to use. Binding also decides whether to use reliable messaging and transaction support.
Contract - The service contract defines what service operations are available to the client for consumption.
So the Address(A), Binding(B) and Contract(C) are called as the ABC of the service end point.
Address - The address where the WCF Service is hosted.
Binding - The binding that decides the protocol, message encoding and security to use. Binding also decides whether to use reliable messaging and transaction support.
Contract - The service contract defines what service operations are available to the client for consumption.
So the Address(A), Binding(B) and Contract(C) are called as the ABC of the service end point.
WCF Interview Questions
WCF Interview Questions
1.What is WCF?
2.How to enable streaming?
3.What types of the operation contract parameters could be streamed?
4.Do we have to change the maxReceivedMessageSize parameter to use streaming?
5.What types of the quota have the WCF transports?
6.What is it the Teredo? How we can use it?
7.What is it the Net.TCP Port Sharing? How we can use it?
8.What are the important principles of SOA (Service oriented Architecture)?
9.What are end points, contract, address and bindings?
10.What are bindings?
11.Which are the various programming approaches for WCF?
12.What is one way operation?
13.Can you explain duplex contracts in WCF?
14.How can we host a service on two different protocols on a single server?
15.How can we use MSMQ bindings in WCF?
16.Can you explain transactions in WCF?
17.Can we use the two-way service operations with queued binding?
18.Could the ExactlyOnce property of the netMsmqBinding be true if the queue is not transactional?
19.When is the MsmqIntegrationBinding or the NetMsmqBinding used?
20.Is there an error in the Msmq address the "net.msmq://MyHost/private$/MyQueue"?
21.Can we use the public queues without the Windows domain? If cannot then why?
22.Which specifications does WCF follow?
23.What are the main components of WCF?
24.Can you explain how End points, Contract, Address and Bindings are done in WCF?
25.What is a service class?
26.What is a service contract, operation contract and Data Contract?
27.What are the various ways of hosting a WCF service?
28.What are the major differences between services and Web services?
29.What is the difference WCF and Web services?
30.What are different bindings supported by WCF?
31.What different transaction isolation levels provided in WCF?
32.Can we do transactions using MSMQ?
33.Can we have two way communications in MSMQ?
34.What are Volatile queues?
35.What are Dead letter queues?
36.What is a poison message?
37.How can we access XAML objects in behind code?
38.What are the kind of documents are supported in WPF?
39.Windows workflow foundation(Vista series)
40.What is Windows Workflow Foundation?
41.WPF Interview questions What is WPF?
42.What is XAML?
43.What are dependency properties?
44.Are XAML file compiled or built on runtime?
45.Can you explain how we can separate code and XAML?
1.What is WCF?
2.How to enable streaming?
3.What types of the operation contract parameters could be streamed?
4.Do we have to change the maxReceivedMessageSize parameter to use streaming?
5.What types of the quota have the WCF transports?
6.What is it the Teredo? How we can use it?
7.What is it the Net.TCP Port Sharing? How we can use it?
8.What are the important principles of SOA (Service oriented Architecture)?
9.What are end points, contract, address and bindings?
10.What are bindings?
11.Which are the various programming approaches for WCF?
12.What is one way operation?
13.Can you explain duplex contracts in WCF?
14.How can we host a service on two different protocols on a single server?
15.How can we use MSMQ bindings in WCF?
16.Can you explain transactions in WCF?
17.Can we use the two-way service operations with queued binding?
18.Could the ExactlyOnce property of the netMsmqBinding be true if the queue is not transactional?
19.When is the MsmqIntegrationBinding or the NetMsmqBinding used?
20.Is there an error in the Msmq address the "net.msmq://MyHost/private$/MyQueue"?
21.Can we use the public queues without the Windows domain? If cannot then why?
22.Which specifications does WCF follow?
23.What are the main components of WCF?
24.Can you explain how End points, Contract, Address and Bindings are done in WCF?
25.What is a service class?
26.What is a service contract, operation contract and Data Contract?
27.What are the various ways of hosting a WCF service?
28.What are the major differences between services and Web services?
29.What is the difference WCF and Web services?
30.What are different bindings supported by WCF?
31.What different transaction isolation levels provided in WCF?
32.Can we do transactions using MSMQ?
33.Can we have two way communications in MSMQ?
34.What are Volatile queues?
35.What are Dead letter queues?
36.What is a poison message?
37.How can we access XAML objects in behind code?
38.What are the kind of documents are supported in WPF?
39.Windows workflow foundation(Vista series)
40.What is Windows Workflow Foundation?
41.WPF Interview questions What is WPF?
42.What is XAML?
43.What are dependency properties?
44.Are XAML file compiled or built on runtime?
45.Can you explain how we can separate code and XAML?
What is WCF?
What is WCF?
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.
First let us give a short answer to this: - “WCF (Indigo was the code name for WCF) is a
unification of .NET framework communication technologies
“.WCF is a unification technology,
which unites the following technologies:-
• NET remoting
• MSMQ
• Web services
• COM+
Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.
First let us give a short answer to this: - “WCF (Indigo was the code name for WCF) is a
unification of .NET framework communication technologies
“.WCF is a unification technology,
which unites the following technologies:-
• NET remoting
• MSMQ
• Web services
• COM+
What was the code name for WCF?
What was the code name for WCF?
The code name of WCF was Indigo .
WCF is a unification of .NET framework communication technologies which unites the following technologies:-
1.Web services
2.MSMQ
3.NET remoting
4.COM+
The code name of WCF was Indigo .
WCF is a unification of .NET framework communication technologies which unites the following technologies:-
1.Web services
2.MSMQ
3.NET remoting
4.COM+
What are the main components of WCF?
What are the main components of WCF?
The main components of WCF are
1. Service class
2. Hosting environment
3. End point
The main components of WCF are
1. Service class
2. Hosting environment
3. End point
Where we can host WCF services?
Where we can host WCF services?
Every WCF services must be hosted somewhere. There are three ways of hosting WCF services.
They are
1. IIS
2. Self Hosting
3. WAS (Windows Activation Service)
Every WCF services must be hosted somewhere. There are three ways of hosting WCF services.
They are
1. IIS
2. Self Hosting
3. WAS (Windows Activation Service)
What is service and client in perspective of data communication?
What is service and client in perspective of data communication?
A service is a unit of functionality exposed to the world.
The client of a service is merely the party consuming the service.
What are different elements of WCF Srevices Client configuration file?
What are different elements of WCF Srevices Client configuration file?
WCF Services client configuration file contains endpoint, address, binding and contract.
WCF Services client configuration file contains endpoint, address, binding and contract.
What is endpoint in WCF?
Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service. In WCF the relationship between Address, Contract and Binding is called Endpoint.
What are ends, contract, address, and bindings?
What are ends, contract, address, and bindings?
The above terminologies are the core on which SOA stands. Every service must expose one or
more ends by which the service can be available to the client. End consists of three important
things where, what and how:-
• Contract (What)
Contract is an agreement between two or more parties. It defines the protocol how client should
communicate with your service. Technically, it describes parameters and return values for a
method.
• Address (Where)
An Address indicates where we can find this service. Address is a URL, which points to the
location of the service.
• Binding (How)
Bindings determine how this end can be accessed. It determines how communications is done.
For instance, you expose your service, which can be accessed using SOAP over HTTP or
BINARY over TCP. So for each of these communications medium two bindings will be created.
Below figure, show the three main components of end. You can see the stock ticker
is the service
class, which has an end hosted on www.soa.com with HTTP and TCP binding support and using
Stock Ticker interface type.
The above terminologies are the core on which SOA stands. Every service must expose one or
more ends by which the service can be available to the client. End consists of three important
things where, what and how:-
• Contract (What)
Contract is an agreement between two or more parties. It defines the protocol how client should
communicate with your service. Technically, it describes parameters and return values for a
method.
• Address (Where)
An Address indicates where we can find this service. Address is a URL, which points to the
location of the service.
• Binding (How)
Bindings determine how this end can be accessed. It determines how communications is done.
For instance, you expose your service, which can be accessed using SOAP over HTTP or
BINARY over TCP. So for each of these communications medium two bindings will be created.
Below figure, show the three main components of end. You can see the stock ticker
is the service
class, which has an end hosted on www.soa.com with HTTP and TCP binding support and using
Stock Ticker interface type.
What is binding and how many types of bindings are there in WCF?
What is binding and how many types of bindings are there in WCF?
A binding defines how an endpoint communicates to the world. A binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.
WCF supports nine types of bindings.
Basic binding
Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.
This binding is used when we need to use SOAP over HTTP. This binding
can also be configured to be used as HTTPS. It can be also configured to send data in plain text or
in optimized form like MTOM.
TCP binding
Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.
This binding sends binary-encoded SOAP, including support for reliable
message transfer, security, and transactions, directly over TCP. The biggest disadvantage of
NetTcpBinding is that both server and client should be also made in .NET language.
Peer network binding
Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.
IPC binding
Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.
Web Service (WS) binding
Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.
It is same like BasicHttpBinding. In short, it uses SOAP over HTTP. But with
it also supports reliable message transfer, security and transaction. WS-Reliable Messaging,
security with WS-Security, and transactions with WS-Atomic Transaction supports reliable
message.
Federated WS binding
Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.
Duplex WS binding
Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.
MSMQ binding
Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.
MSMQ integration binding
Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.
This binding sends binary-encoded SOAP over MSMQ. This binding can
only be used for WCF-to-WCF communication.
Which specifications does WCF follow?
Which specifications does WCF follow?
WCF supports specifications defined by WS-* specifications. WS-* specifications are defined
together by Microsoft, IBM, SUN and many other big companies so that they can expose there
service through a common protocol. WCF supports all specifications defined we will understand
them one by one.
• Messaging (WS-Addressing):- SOAP is the fundamental protocol for web services. WS
Addressing defines some extra additions to SOAP headers, which makes SOAP free from
underlying transport protocol. One of the good things about Message transmission is MTOM,
also termed as Message Transmission Optimization Mechanism. They optimize transmission
format for SOAP messages in XML-Binary formant using XML optimized packaging (XOP).
Because the data will sent in binary and optimized format, it will give us huge performance
gain.
• Security (WS-Security, WS-Trust, and WS-Secure Conversation): All the three WSdefine
authentication, security, data integrity and privacy features for a service.
• Reliability (WS-Reliable Messaging): This specification ensures end-to-end
communication when we want SOAP messages to be traversed back and forth many times.
• Transactions (WS-Coordination and WS-Atomic Transaction): These two specifications
enable transaction with SOAP messages.
• Metadata (WS-Policy and WS-Metadata exchange): WSDL is a implementation of WSMetadata
Exchange protocol. WS-Policy defines more dynamic features of a service, which
cannot be expressed by WSDL.
WCF follows WS-* specifications other
languages like JAVA , C++ can also exploit features like Messaging , Security , Reliability and
transactions written in C# or VB.NET. This is the biggest achievement of WCF to integrate the
above features with other languages.
WCF supports specifications defined by WS-* specifications. WS-* specifications are defined
together by Microsoft, IBM, SUN and many other big companies so that they can expose there
service through a common protocol. WCF supports all specifications defined we will understand
them one by one.
• Messaging (WS-Addressing):- SOAP is the fundamental protocol for web services. WS
Addressing defines some extra additions to SOAP headers, which makes SOAP free from
underlying transport protocol. One of the good things about Message transmission is MTOM,
also termed as Message Transmission Optimization Mechanism. They optimize transmission
format for SOAP messages in XML-Binary formant using XML optimized packaging (XOP).
Because the data will sent in binary and optimized format, it will give us huge performance
gain.
• Security (WS-Security, WS-Trust, and WS-Secure Conversation): All the three WSdefine
authentication, security, data integrity and privacy features for a service.
• Reliability (WS-Reliable Messaging): This specification ensures end-to-end
communication when we want SOAP messages to be traversed back and forth many times.
• Transactions (WS-Coordination and WS-Atomic Transaction): These two specifications
enable transaction with SOAP messages.
• Metadata (WS-Policy and WS-Metadata exchange): WSDL is a implementation of WSMetadata
Exchange protocol. WS-Policy defines more dynamic features of a service, which
cannot be expressed by WSDL.
WCF follows WS-* specifications other
languages like JAVA , C++ can also exploit features like Messaging , Security , Reliability and
transactions written in C# or VB.NET. This is the biggest achievement of WCF to integrate the
above features with other languages.
Difference between WCF and Web services?
What is the difference between WCF and Web services?
Web services can only be invoked by HTTP. While Service or a WCF component can be invoked
by any protocol and any transport type. Second web services are not flexible. However, Services
are flexible. If you make a new version of the service then you need to just expose a new end.
Therefore, services are agile and which is a very practical approach looking at the current
business trends.
Web services can only be invoked by HTTP. While Service or a WCF component can be invoked
by any protocol and any transport type. Second web services are not flexible. However, Services
are flexible. If you make a new version of the service then you need to just expose a new end.
Therefore, services are agile and which is a very practical approach looking at the current
business trends.
What are the advantages of hosting WCF Services in IIS as compared to self-hosting?
What are the advantages of hosting WCF Services in IIS as compared to self-hosting?
There are two main advantages of using IIS over self-hosting:-
Automatic activation
IIS provides automatic activation that means the service is not necessary to be running in
advance. When any message is received by the service it then launches and fulfills the request.
But in case of self hosting the service should always be running.
Process recycling
If IIS finds that a service is not healthy that means if it has memory leaks etc, IIS recycles the
process. For every browser instance, a
worker process is spawned and the request is serviced. When the browser disconnects the worker,
process stops and you loose all information. IIS also restarts the worker process. By default, the
worker process is recycled at around 120 minutes. So why does IIS recycle. By restarting the
worker process it ensures any bad code or memory leak do not cause issue to the whole system.
In case of self-hosting both the above features, you will need to code yourself. Lot of work
right!!.
There are two main advantages of using IIS over self-hosting:-
Automatic activation
IIS provides automatic activation that means the service is not necessary to be running in
advance. When any message is received by the service it then launches and fulfills the request.
But in case of self hosting the service should always be running.
Process recycling
If IIS finds that a service is not healthy that means if it has memory leaks etc, IIS recycles the
process. For every browser instance, a
worker process is spawned and the request is serviced. When the browser disconnects the worker,
process stops and you loose all information. IIS also restarts the worker process. By default, the
worker process is recycled at around 120 minutes. So why does IIS recycle. By restarting the
worker process it ensures any bad code or memory leak do not cause issue to the whole system.
In case of self-hosting both the above features, you will need to code yourself. Lot of work
right!!.
What are the various ways of hosting a WCF service?
What are the various ways of hosting a WCF service?
There are three major ways to host a WCF service:-
• Self-hosting the service in his own application domain. This we have already covered in
the first section. The service comes in to existence when you create the object of Service
Host class and the service closes when you call the Close of the Service Host class.
• Host in application domain or process provided by IIS Server.
• Host in Application domain and process provided by WAS (Windows Activation
Service) Server.
There are three major ways to host a WCF service:-
• Self-hosting the service in his own application domain. This we have already covered in
the first section. The service comes in to existence when you create the object of Service
Host class and the service closes when you call the Close of the Service Host class.
• Host in application domain or process provided by IIS Server.
• Host in Application domain and process provided by WAS (Windows Activation
Service) Server.
Which are the various programming approaches for WCF?/What is one-way operation?
Which are the various programming approaches for WCF?/What is one-way operation?
IsOneWay equal to true ensures that the client does not have to wait for the response. So methods
marked by IsOneWay to true should always return void. In this, the caller does not get anything
IsOneWay equal to true ensures that the client does not have to wait for the response. So methods
marked by IsOneWay to true should always return void. In this, the caller does not get anything
Subscribe to:
Posts (Atom)