Posts

Showing posts from July, 2015

Understand FormCollection in MVC Controller

Image
We know that there are various ways to collect data from a view to a collection, FomrCollection is one of them. We will implement a simple example of a FomrCollection shortly. To implement it we need to create a MVC application. Here is the view to create the HTML form element We are using a .aspx view in this application and a HTML helper class to generate HTML elements. If we look closely at the form element we will see that the form data will be submited for the “savedata” action defined within the “person” controller. Have a look at the following code. <% @   Page   Language ="C#"   Inherits ="System.Web.Mvc.ViewPage<MVC_Test.Models.person>"   %> <! DOCTYPE   html > < html > < head   runat ="server">      < meta   name ="viewport"   content ="width=device-width"   />      < title > Index </ title > </ head > < body > ...

WCF Windows Service Hosting

Image
We are going to see the hosting WCF service in Windows service. We will use same set of code used for hosting the WCF service in Console application to this. This is same as hosting the service in IIS without message activated. There is some advantage of hosting service in Windows service. The service will be hosted, when system starts Process life time of the service can be controlled by Service Control Manager for windows service All versions of Windows will support hosting WCF service. Step 1:  Now let start create the WCF service, Open the Visual Studio 2008 and click New->Project and select Class Library from the template. Step 2:  Add reference  System.ServiceModel  to the project. This is the core assembly used for creating the WCF service. Step 3:  Next we can create the  ISimpleCalulator  interface as shown below. Add the Service and Operation Contract attribute as shown below. ISimpleCalculator.cs using System; using ...

WCF Windows Activation Service Hosting

Image
Windows Activation service is a system service available with Windows vista and windows server 2008. It is available with IIS 7.0 and it is more powerful compared to IIS 6.0 because it supports Http, TCP and named pipes were IIS 6.0 supports only Http. It can be installed and configured separately. Hosting WCF in Activation service takes many advantages such as process recycling, isolation, idle time management and common configuration system. WAS hosted service can be created using following steps Enable WCF for non-http protocols Create WAS hosted service Enable different binding to the hosted service Enable WCF for non-http protocols Before Start creating the service we need to configure the system to support WAS. Following are the step to configure WAS. Click Start -> Control Panel -> programs and Features and click 'Turn Windows Components On or Off' in left pane. Expand 'Microsoft .Net Framework 3.0' and enable "Windows Communication F...