Search This Blog

Tuesday, September 14, 2010

Transports in Windows Communication Foundation

Transports in Windows Communication Foundation
The main transports used in Windows Communication Foundation (WCF) are HTTP, HTTPS, TCP, and named pipes. The topics in this section discuss choosing among these transports, configuring the transport, and setting tuning properties.
Choosing a Transport
This topic discusses criteria for choosing among the three main transports that are included in Windows Communication Foundation (WCF): HTTP, TCP, and named pipes.
The WCF programming model separates endpoint operations (as expressed in a service contract) from the transport mechanism that connects two endpoints. This gives you the flexibility to decide how to expose your services to the network. If you must connect to an existing client or server, you may not have a choice about using a particular transport. However, WCF services can be made accessible through multiple endpoints, each with a different transport. When a single transport does not cover the intended audience for your service, consider exposing the service over multiple endpoints. Client applications can then use the endpoint that is best for them.
When to Use HTTP Transport
HTTP is a request/response protocol between clients and servers. The most common application consists of Web-browser clients that communicate with a Web server. The client sends a request to a server, which listens for client request messages. When the server receives a request, it returns a response, which contains the status of the request. If successful, optional data, such as a Web page, an error message, or other information is returned.The HTTP protocol is not connection-based—once the response is sent, no state is maintained. To handle multiple-page transactions, the application must persist any necessary state.
When to Use the TCP Transport
TCP is a connection-based, stream-oriented delivery service with end-to-end error detection and correction. Connection-based means that a communication session between hosts is established before exchanging data. A host is any device on a TCP/IP network identified by a logical IP address.TCP provides reliable data delivery and ease of use. Specifically, TCP notifies the sender of packet delivery, guarantees that packets are delivered in the same order in which they are sent, retransmits lost packets, and ensures that data packets are not duplicated. Note that this reliable delivery applies between two TCP/IP nodes, and is not the same thing as WS-ReliableMessaging, which applies between endpoints, no matter how many intermediate nodes they may include.
When to Use the Named Pipe Transport
A named pipe is an object in the Windows operating system kernel, such as a section of shared memory that processes can use for communication. A named pipe has a name, and can be used for one-way or duplex communication between processes on a single machine.When communication is required between different WCF applications on a single computer, and you want to prevent any communication from another machine, then use the named pipes transport. An additional restriction is that processes running from Windows Remote Desktop may be restricted to the same Windows Remote Desktop session unless they have elevated privileges.

Tuesday, September 7, 2010

WCF Services

WCF Services

All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service.

Each endpoint consists of four properties:

An address that indicates where the endpoint can be found. The address uniquely identifies the endpoint and tells potential consumers of the service where it is located. It is represented in the WCF object model by the EndpointAddress class.

A binding that specifies how a client can communicate with the endpoint. The binding specifies how to communicate with the endpoint. This includes:

-The transport protocol to use (for example, TCP or HTTP).

-The encoding to use for the messages (for example, text or binary).

-The necessary security requirements (for example, SSL or SOAP message security).

A contract that identifies the operations available. The contract outlines what functionality the endpoint exposes to the client. A contract specifies:

-What operations can be called by a client.

-The form of the message.

-The type of input parameters or data required to call the operation.

-What type of processing or response message the client can expect.

A set of behaviors that specify local implementation details of the endpoint. You can use endpoint behaviors to customize the local behavior of the service endpoint. Endpoint behaviors achieve this by participating in the process of building a WCF runtime. An example of an endpoint behavior is the ListenUri property, which allows you to specify a different listening address than the SOAP or Web Services Description Language (WSDL) address.

Data transfer and serialization in WCF service.

The Windows Communication Foundation (WCF) can be thought of as a messaging infrastructure. Service operations can receive messages, process them, and send them messages. Messages are described using operation contracts. For example, consider the following contract.

[ServiceContract] - This shows what services are offered to the client.

[OperationContract] - This shows what operations are exposed within the service to the client.

[DataContract] - This is used when the parameter passed need to act as both for request and reply messages. They makes use of DataContractSerializer.

[MessageContract] - This is used to represent the request and the reply message using single type. This can be implemented using datacontract also. But message contract avoids unnecessary levels of wrapping in the resultant xml. Also, message contracts can specify what shld be the message body and what shld be message header.

Sessions, Instancing, and Concurrency in Windows Communication Foundation

A session is a correlation of all messages sent between two endpoints. Instancing refers to controlling the lifetime of user-defined service objects and their related InstanceContext objects. Concurrency is the term given to the control of the number of threads executing in an InstanceContext at the same time.

Monday, September 6, 2010



Language-Integrated Query (LINQ) is a new feature in Visual Studio 2008 and the .NET Framework 3.5. LINQ extends powerful query capabilities to the language syntax of C# and Visual Basic in the form of standard, easily-learned query patterns. This technology can be extended to support potentially any kind of data store. The .NET Framework 3.5 includes LINQ provider assemblies that enable the use of LINQ for querying .NET Framework collections, SQL Server databases, ADO.NET Datasets, and XML documents.

The components of LINQ that are part of the .NET Framework 3.5 are:

The System.Linq namespace, which contains the set of standard query operators and types and interfaces that are used in the infrastructure of a LINQ query. This namespace is in the System.Core.dll assembly.

The System.Data.Linq namespace, which contains classes that support interaction with relational databases in LINQ to SQL applications.

The System.Data.Linq.Mapping namespace, which contains classes that can be used to generate a LINQ to SQL object model that represents the structure and content of a relational database.

The System.Xml.Linq namespace, which contains the classes for LINQ to XML. LINQ to XML is an in-memory XML programming interface that enables you to modify XML documents efficiently and easily. Using LINQ to XML, you can load XML, serialize XML, create XML trees from scratch, manipulate in-memory XML trees, and validate by using XSD. You can also use a combination of these features to transform XML trees from one shape into another.

New types in the System.Web.UI.WebControls and System.Web.UI.Design.WebControls namespaces. These new types, such as LinqDataSource, support the use of LINQ in ASP.NET Web pages through a data source control.

The DataRowComparer, DataRowExtensions, and DataTableExtensions classes in the System.Data namespace support LINQ queries against ADO.NET DataSet objects.

In the class library, the LINQ extension methods that apply to a class are listed in the members page for the class, in the Contents pane, and in the Index pane.

Friday, September 3, 2010

New features of .Net 3.5

New features of .Net 3.5

Lets check out some new features included in the latest but one version thats .Net 3.5 framework. However, .Net 4.0 version has already been launched and is making news!!!

The .NET Compact Framework version 3.5 expands support for distributed mobile applications by including the Windows Communication Foundation (WCF) technology. It also adds new language features such as LINQ, new APIs based on community feedback, and improves debugging with updated diagnostic tools and features.

The most significant advance is improved support for the development of AJAX-enabled Web sites. ASP.NET supports server-centric AJAX development with a set of new server controls and APIs. You can enable an existing ASP.NET 2.0 page for AJAX by adding a ScriptManager control and an UpdatePanel control so that the page can update without requiring a full page refresh.

Other improvements in ASP.NET include a new data control, ListView, for displaying data; a new data source control, LinqDataSource, that exposes Language Integrated Query (LINQ) to Web developers through the ASP.NET data source control architectures; a new tool, ASP.NET Merge Tool (Aspnet_merge.exe), for merging precompiled assemblies; and tight integration with IIS 7.0. ListView is a highly customizable control (using templates and styles) that also supports edit, insert, and delete operations, as well as sorting and paging functionality. The paging functionality for ListView is provided by a new control called DataPager. You can use the merge tool to combine assemblies to support a range of deployment and release management scenarios. The integration of ASP.NET and IIS 7.0 includes the ability to use ASP.NET services, such as authentication and caching, for any content type. It also includes the ability to develop server pipeline modules in ASP.NET managed code and supports unified configuration of modules and handlers.

Other improvements in Visual Web Developer include multitargeting support, inclusion of Web Application Projects, a new Design view, new Cascading Style Sheets (CSS) design tools, and support for LINQ for SQL databases. Multitargeting enables you to use Visual Web Developer to target development of Web applications to specific versions of the .NET Framework, including versions 2.0, 3.0, and 3.5.