Friday, November 25, 2011

Comparison of various bindings in WCF

In my previous post I had discussed the differences between WCF and Web-Services. In this post I am going to show the difference between the various bindings in the WCF.


Class name
Description
Transport
Message encoding
Security
BasicHttpBinding
A binding that is suitable for communication with WS-Basic Profile conformant Web Services like ASMX-based services. This binding uses HTTP as the transport and Text/XML as the message encoding.
HTTP
Text
None
WSHttpBinding
A secure and interoperable binding that is suitable for non-duplex service contracts.
HTTP
Text
Message
WSDualHttpBinding
A secure and interoperable binding that is suitable for duplex service contracts or communication through SOAP intermediaries.
HTTP
Text
Message
WSFederationHttpBinding
A secure and interoperable binding that supports the WS-Federation protocol, enabling organizations that are in a federation to efficiently authenticate and authorize users.
HTTP
Text
Message
NetTcpBinding
A secure and optimized binding suitable for cross-machine communication between WCF applications
TCP
Binary
Transport
NetPeerTcpBinding
A binding that enables secure, multi-machine communication.
P2P
Binary
Transport
NetNamedPipesBinding
A secure, reliable, optimized binding that is suitable for on-machine communication between WCF applications.
Named Pipes
Binary
Transport
NetMsmqBinding
A queued binding that is suitable for cross-machine communication between WCF applications.
MSMQ
Binary
Message
MsmqIntegrationBinding
A binding that is suitable for cross-machine communication between a WCF application and existing MSMQ applications.
MSMQ
doesn’t use a WCF message encoding – instead it lets you choose a pre-WCF serialization format
Transport




Further the most commonly used binding are BasicHttpBinding and WsHttpBinding. The difference between these two is as follows:
Criteria
BasicHttpBinding

WsHttpBinding   

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

The following video will make this more clear:



Wednesday, September 28, 2011

Cloud Computing and India by 2020


As per the recent survey done by NASSCOM in association with Deloitte regarding Cloud Computing and its futue in India, it was found that Cloud Computing is gaining momentum in India is its market is expected to grow to $16 billion by 2020. The global cloud computing market was projected to grow by 33 per cent compounded annual growth rate and readch $680 billion by year 2020. In India Cloud Computing is going to effect and revolutionize the IT-BPO serivce industry in India.

Though there are many challenges that we need to overcome before Cloud Computing can be readily accepted by industry. Some of the main challanges are:

• Perceived security concerns.This was the area most frequently referenced with respect to restricting cloud computing investment. Many firms remain reluctant to move any  of their services to a public cloud environment since they prefer to keep their data behind their own firewalls. This situation is only likely to change if cloud service providers accept liability for the data, removing the litigation risk which currently sits with the customer regarding data loss or leakage.

• Service reliability. This has been brought into sharp focus with the April 2011 multi-day outage of Amazon Web Services. This outage resulted in the slow-down and in some cases, shut-down, of prominent internet sites such as Quora and Reddit. Many firms cannot countenance a similar outage across their IT estate.

• Vendor lock-in. Firms are concerned about moving to a  public cloud deployment model since they fear becoming dependent on the provider’s service and exposed  to any future price increases in  the subscription.






• Lack of clarity in the business case. While firms can understand  the subscription-based costs associated with a public cloud service, understanding how this compares to the costs of the existing operations proves challenging since it is necessary to dentify and calculate the costs of the hardware and people that support the existing operations.

Friday, September 23, 2011

Market share as of Sep-2011 of OS, browser and search engine for Mobile and Desktop

As per the recent survey the market share as of Sep-2011 of Operating System, browser and search engine for Mobile and Desktop is shown as under.



It is clear the Google is the sole leader in search engine both in mobile and desktop category. Microsoft Windows is the clear winner for desktop OS (no one even close !!).





In the smart phone category, current iOS is leading with just over half the market share, but Android is fast catching up. Symbian on the other hand is on a continuous down-trend.

.net what's next ? --> Its vNext !

So gear up for a new release of .net by early 2012 and it would be .net framework version 4.5. Currently Microsoft is running a informative feature about this new release by the code-word vNext. Many blogs and articles are being written by those in Microsoft about this, but the most elaborative and informative is the one run by Scott Guthrie on the vNext. A detailed list of various articles on vNext series by Scott Gurthrie is here.




There are many cool changes both in the Visual Studio API and .Net Framework making the life of developers easy. Some of the new features are :


There are many more up-coming features and I will be posting about them as they are made public.

Wednesday, August 31, 2011

Merge Data Tables Easily

Many a times we face a situation where we have to merge data from multiple DataTable into single DataTable.  Previously we achieved this by iterating through the data rows in the DataTable and adding one by one into the single DataTable. This not only is memory consuming but also a bad practice.

To overcome this .net 4.0 now has a new DataTable function i.e. Merge(). The following program will make it more clear.


private static void DemonstrateMergeTable()
{
    DataTable table1 = new DataTable("Items");

    // Add columns
    DataColumn idColumn = new DataColumn("id", typeof(System.Int32));
    DataColumn itemColumn = new DataColumn("item", typeof(System.Int32));
    table1.Columns.Add(idColumn);
    table1.Columns.Add(itemColumn);

    // Set the primary key column.
    table1.PrimaryKey = new DataColumn[] { idColumn };

    // Add RowChanged event handler for the table.
    table1.RowChanged += new 
        System.Data.DataRowChangeEventHandler(Row_Changed);

    // Add ten rows.
    DataRow row;
    for (int i = 0; i <= 9; i++)
    {
        row = table1.NewRow();
        row["id"] = i;
        row["item"] = i;
        table1.Rows.Add(row);
    }

    // Accept changes.
    table1.AcceptChanges();
    PrintValues(table1, "Original values");

    // Create a second DataTable identical to the first.
    DataTable table2 = table1.Clone();

    // Add column to the second column, so that the 
    // schemas no longer match.
    table2.Columns.Add("newColumn", typeof(System.String));

    // Add three rows. Note that the id column can't be the 
    // same as existing rows in the original table.
    row = table2.NewRow();
    row["id"] = 14;
    row["item"] = 774;
    row["newColumn"] = "new column 1";
    table2.Rows.Add(row);

    row = table2.NewRow();
    row["id"] = 12;
    row["item"] = 555;
    row["newColumn"] = "new column 2";
    table2.Rows.Add(row);

    row = table2.NewRow();
    row["id"] = 13;
    row["item"] = 665;
    row["newColumn"] = "new column 3";
    table2.Rows.Add(row);

    // Merge table2 into the table1.
    Console.WriteLine("Merging");
    table1.Merge(table2, false, MissingSchemaAction.Add);
    PrintValues(table1, "Merged With table1, schema added");

}

private static void Row_Changed(object sender, 
    DataRowChangeEventArgs e)
{
    Console.WriteLine("Row changed {0}\t{1}", e.Action, 
        e.Row.ItemArray[0]);
}

private static void PrintValues(DataTable table, string label)
{
    // Display the values in the supplied DataTable:
    Console.WriteLine(label);
    foreach (DataRow row in table.Rows)
    {
        foreach (DataColumn col in table.Columns)
        {
            Console.Write("\t " + row[col].ToString());
        }
        Console.WriteLine();
    }
}

Wednesday, June 29, 2011

Choosing the Right Collection Class

In .net we have number of collection classes that are very useful in managing collections of object. But the question is which one should we use to get the best performance. The answer is that what is the scenario and the output that one requires from the collection, depending on which the selection of the collection type should be made. The following table explains the basic parameters for collections that should be kept in mind while selection the type of collection.


Collection
Ordered?
Contiguous Storage?
Direct Access?
Lookup Efficiency
Notes
Dictionary
No
Yes
Via Key
Key:
O(1)
Best for high performance lookups.
Sorted
Dictionary
Yes No Via Key Key:
O(log n)
Compromise of Dictionary speed and ordering, uses binary search tree.
SortedList
Yes
Yes
Via Key
Key:
O(log n)
Very similar to SortedDictionary, except tree is implemented in an array, so has faster lookup on preloaded data, but slower loads.
List
No
Yes
Via Index
Index: O(1)
Value: O(n)
Best for smaller lists where direct access required and no ordering.
LinkedList
No
No
No
Value:
O(n)
Best for lists where inserting/deleting in middle is common and no direct access required.
HashSet
No
Yes
Via Key
Key:
O(1)
Unique unordered collection, like a Dictionary except key and value are same object.
SortedSet
Yes
No
Via Key
Key:
O(log n)
Unique ordered collection, like SortedDictionary except key and value are same object.
Stack
No
Yes
Only Top
Top: O(1)
Essentially same as List except only process as LIFO
Queue
No
Yes
Only Front
Front: O(1)
Essentially same as List except only process as FIFO

For more read this good article.

LinkWithin

Related Posts with Thumbnails