.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

Post New Question Subscribe to Interview Questions
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
NetworkingAptitudeOthers  All    

Interview Questions And Answers

Does all WCF bindings support for Transaction Propagation?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

No. Not all WCF bindings support transaction propagation. Only following list of bindings support for it.
. wsHttpBinding
. netTcpBinding
. netNamedPipeBinding
. wsDualHttpBinding
. wsFederationHttpBinding

What is Transaction Propagation? And how WCF support it?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

Transaction propagation is the ability to propagate transaction across the boundaries of a single service. Or in other words, we can say that a service can participate in a transaction that is initiated by a client.
In a SOA environment, transaction propagation becomes a key requirement. As we know that WCF supports SOA, so it provides support for transaction propagation as well.
To enable transaction propagation, we need to set the value of TransactionFlow property of the binding being used. This can be done programmatically as follows:
WSHttpBinding bindingBeingUsed = new WSHttpBinding();
bindingBeingUsed.TransactionFlow = "true";
Or It can be done declaratively by updating configuration file as follows:
<binding name="binding1"
transactionFlow="true" />
Default value for TransactionFlow property is "False".

What is ESB in SOA environment?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

In Service Oriented Architecture environment, ESB (Enterprise Service Bus) acts as a single interface for all messaging between applications and services in a loosely coupled manner. ESB is capable to call and subscribe different service provider's methods and subscriptions respectively.

What are Reliable Sessions in WCF?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

Reliable sessions actually ensure that the caller for messages will know about the lost message(s) but it can't guarantee about the delivery of message(s).
There is a misconception about reliable sessions that it ensures the session will never expire or stays for a very long time. This we can achieve by using timeout for sessions.

Difference between BasicHttpBinding and WsHttpBinding with respect to security?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

but basic difference with respect to security is as follows:
As WsHttpBinding supports advanced WS-* specification, it has a lot more security options available. For example, It provides message-level security i.e. message is not sent in plain text. Also it supports for WS-Trust and WS-Secure conversation.
While in case of BasicHttpBinding, it has fewer security options, or we can say, there is no security provided, by default. At transport level, it can provide confidentiality through SSL.

What are the core security concepts supported by WCF?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

There are four core security Features
1. Confidentiality: It's a confirmation about the recipient. Only the valid recipient can read the message when it passed between service and client.
2. Integrity: is to ensure that message received is not being tempered or changed during exchange.
3. Authentication: is a way for the parties (sender and receiver) to identify each other.
4. Authorization: ensures that what actions an authenticated user can perform?

What is a fault contract?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

Normally, by default, when some exception occurs at a WCF service level, it will not expose as it is to client. Reason is that WCF exception is a CLR exception and it doesn't make sense to expose it outside CLR because it contains internal details of service code like stack trace. So, WCF handles and returns error details to client using Fault Contract."So, fault contract is a contract that contains the details of possible exception(s) that might occur in a service code."
public interface IService1
int MyOperation1();
public class MyFaultDetails
public string ErrorDetails { get; set; }
In implementing service...
public int MyOperation1()
Try{ //Do something.. }catch()
MyFaultDetails ex = new MyFaultDetails();
ex.ErrorDetails = "Specific error details here.";
throw new FaultException(ex,"Reason: Testing...");

Difference between using ChannelFactory and Proxies in WCF?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

A ChannelFactory creates a kind of Channel used by clients to communicate with service endpoints.
If we have control over Server and Client, then ChannelFactory is a good option because it relies on having local interfaces that actually describes the service i.e. service contract.
On the other hand, If we don't have control over server and only have WSDL/URL, then it's better to generate proxy using Visual Studio or SvcUtil.
SvcUtil is better option as compared to Visual Studio because we have more control in case of SvcUtil.

What is mexHttpBinding in WCF?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

In order to generate proxy, we need service metadata and mexHttpBinding returns service metadata.
If we look into our configuration file, service will have an endpoint with mexHttpBinding as follows:
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
and service metadata behavior will be configured as follows:
<serviceMetadata httpGetEnabled="true"/>
Before deployment of application to production machine, it should be disabled.
In order to support other protocols, related bindings are mexHttpBinding, mexHttpsBinding, mexTcpBinding.

What are the different ways to expose WCF Metadata?

Author: Alankar          Posted Date: April 02, 2015    Category: WCF     Points: 40

By default, WCF doesn't expose metadata. We can expose it by choosing one of the following ways:
1. In configuration file, by enabling metadata exchange as follows:
<service name="MyService.Service1?
<endpoint address=""
<dns value="localhost"/>
<endpoint address="mex" binding="mexHttpBinding"
<behavior name="MyService.Service1?>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
2. ServiceHost can expose a metadata exchange endpoint to access metadata at runtime.
using (ServiceHost host = new ServiceHost(typeof(MyService)))
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpGetEnabled = true;
Console.WriteLine("My Service here...."); Console.ReadLine();

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend