Skip to main content

Posts

Showing posts from March, 2010

SOA-based WCF architecture

The WCF architecture is based on the design principles of service-oriented architecture (SOA). SOA is a framework that is used to design service-based distributed systems. In an SOA-based system, platform-independent services communicate across networked computers or computer processes. WCF implements. Explicit boundaries WCF services function using defined interfaces to identify the communications that flow outside the boundaries of the service. Independent services All WCF services are deployed and managed independently; they are independent of deployment, installation, and version issues. Also, each service interaction is independent of other interactions. Schema and contract-based communication WCF services communicate with clients by providing only the schema of the message and not its implementation classes. This helps developers change the service implementation in the future without impacting the clients. Policy-based compatibility Compatibility betw

Windows Communication Foundation (WCF) - Glossary

WCF Fundamentals Service are applications that wait for clients to communicate with them and respond to that communication. They expose the functionalities to client. Client initiate the communication. They consume the service offered by Service. Message: A message is a self-contained unit of data that may consist of seveal parts, including a body and headers. Clients & Service  communicate using XML messages. A single application can act as both a client and a service. Endpoints Messages are sent between endpoints. Endpoints are places where messages are sent or received (or both), and they define all the information required for the message exchange. A service exposes one or more application endpoints (as well as zero or more infrastructure endpoints), and the client generates an endpoint that is compatible with one of the service's endpoints. An  endpoint  describes in a standard-based way where messages should be sent, how they should be sent, and

Windows Communication Foundation - overview

WCF is a framework ( yep another framework :D ). It is a unified programming model for building service oriented applications   The WCF architecture uses message-based communication. This involves messages being sent between endpoints generated by either a service or a client. A service is an application that responds to a request, and a client is an application that initiates a request. In many cases, a single application can act as both a client and a service, depending on the situation. WCF is implemented primarily as a set of classes on top of the .NET Framework’s Common Language Runtime (CLR). Because it extends their familiar environment, WCF allows .NET developers to build service-oriented applications in a familiar way. The benefits of WCF asynchronous one-way messaging Many applications use asynchronous one-way messaging. For example, web browsers send requests to web servers and wait for replies. WCF supports asynchronous one-wa

Asp.Net – Creating a new custom HTTP Module

An HTTP Module is a .NET class that executes with each and every page request. You can use an HTTP Module to handle any of the HttpApplication events that you can handle in the Global.asax file. You are already familiar with some of the HTTP Modules like FormsAuthenticationModule handles the Forms authentication WindowsAuthenticationModule handles the Windows authentication SessionStateModule manages the session state of ASP.net application OutputCacheModule deals with output caching ProfileModule used for interaction with user profiles Each HTTP Module subscribes to one or more HttpApplication events. For example, when the HttpApplication object raises its AuthenticateRequest event, the FormsAuthenticationModule executes its code to authenticate the current user. Below I have included a sample class which implements the IHttpModule interface In the Init event I have created an EventHandler for the PostAuthorizeRequest event of Http Application namesp

ASP.net - implementing Asynchronous HTTP handler

Asynchronous programming has its own benefits. It helps in better usage of resources. In ASP.net when a user request for a resource which is to be processed by HTTP Handler a thread is created an allocated to the handler file. The thread will be idle till the file finish it’s processing. So as to minimize this “idle” period using asynchronous programming we can release the thread back to pool after passing the execution to handler file. When the asynchronous handler completes its work, the framework reassigns a thread to the original request and the handler can render content to the browser. For a better understanding of Asynchronous programming in .Net visit: Asynchronous Programming Overview We can create an asynchronous HTTP handler by implementing the IHttpAsyncHandler interface, which is derived from the IHttpHandler interface. It adds two additional methods: IAsyncResult BeginProcessRequest( HttpContext context, AsyncCallback cb, object extraData); —Called to start the

ASP.net - Http handlers - implementing IHttpHandler

Implementing a generic HTTP handler has its own limitations. To give more power to handle request in any URL we can create our own HTTP handlers using the interface IHttpHandler. This interface defines the contract that ASP. NET implements to synchronously process HTTP Web requests using custom HTTP handlers. You can create HTTP handler in any of the .net language which can run in the framework (any CLS compliant language). In the following example I have used C# public class ImageHandlerNew : IHttpHandler     {         const string connectionStringName = "Images" ;         public void ProcessRequest( HttpContext context)         {                     }         public bool IsReusable         {             get { return true ; }         }     } In this example the most important function is ProcessRequest which handles the incoming request from browser, process it and sends back the response. This function takes the current running context as parameter. T