Everything about Windows Communication Foundation

01. December 2013 Tutorial, WCF 0
WCF Tutorial The WCF tutorial is a walk-through which provides the reader with basics of WCF. The contents of this tutorial have gathered mostly from the book Professional C# 2012 and .NET 4.5 by Christian Nagel and the author’s personal notes. WCF Tutorial, Part 1: Introduction WCF Tutorial, Part 2: Create a Simple Service and ...

WCF Duplex Communication Tutorial

01. December 2013 WCF 0
The client starts the connection to the service. After the client connects to the service, the service can call back into the client. Duplex communication can be done with the WsHttpBinding and the NetTcpBinding as well as by using WebSocket protocol. Contract For duplex communication a callback contract must be specified that is implemented in ...

WCF Duplex Communication Security Configurations

01. December 2013 WCF 1
Consider the scenario where the WCF Service has been hosted on Server A where it provides call back contracts for clients to be registered with and get notifications. In order to make the communication works some security settings must be considered. Without defining these configurations the server will be blocking the creation of any channel ...

How to implement and configure two contracts on one WCF service

01. December 2013 WCF 4
In this article demonstrates how you can implement two WCF Service Contracts on one Service and how to configure the service to support it. This became useful in duplex communications where the service needs to expose two different bindings. Consider the following scenario: The Service exposes two endpoints: wsDualHttpBinding and basicHttpBinding. Clients will be create ...

How to Call a WCF Service from Windows PowerShell

01. December 2013 PowerShell, WCF 1
You can call your WCF operation from PowerShell. What you need is to use New-WebServiceProxy cmdlet. New-WebServiceProxy will create a proxy object in order to communicate with the service. Look at the example below: $uri = \"http://192.168.0.1/SampleService.svc?wsdl\" $srv = New-WebServiceProxy -Uri $uri -UseDefaultCredential $result = \"false\" $resultSp = \"false\" $date = (Get-Date).ToString(\"yyyy/MM/dd hh:mm:ss\") $ srv.NotifyStatus(\"Type ...

WCF Tutorial, Part 7: Create WCF Client

01. December 2013 WCF 0
The client application can be of any type from a simple console application to a WPF application. We will use WPF application for demonstration. Add a new WPF Application to the solution and name it as RoomReservationClient Start the service and add the service reference to this project with the name RoomReservationService Doing so will ...

WCF Tutorial, Part 6: Create a Custom Service Host

01. December 2013 WCF 0
You can host WCF services on any hosts, include: Windows Form, WPF, Windows Services, Windows Activation Services (WAS), IIS, or a Console Application. Add a new Console Application to the solution and name it RoomReservationServiceHost Add reference to: RoomReservationService RoomReservationContract System.ServiceModel Copy the necessary configurations from the Service’s App.config into the project’s App.config. Note that ...

WCF Tutorial, Part 5: WCF Service Host and WCF Test Client

01. December 2013 WCF 0
The WCF Service Library project template creates an application configuration file named App.config which needed to be modified to reflect the Service class and interface names. Class names should include the namespace as well. The typical WCF configuration file has the following schema: Configuration system.serviceModel services service ( name = \"RoomReservationService.RoomReservationService\" ) endpoint ( address ...

WCF Tutorial, Part 4: Service Implementation

01. December 2013 WCF 0
Create a WCF Service Library and name it RoomReservationService. Add references to RoomReservationContracts RoomReservationData Remove the Data Contract class and modify the RoomReservationService.cs as bellow: using System; using System.ServiceModel; using RoomReservationContracts; using RoomReservationData; namespace RoomReservationservice { [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class RoomReservationService : IRoomService { public bool ReserveRoom(RoomReservation roomReservation) { var data = new RoomReservationData.RoomReservationData(); ...

WCF Tutorial, Part 3: Create Data Access Library

01. December 2013 WCF 0
Code First Model with ADO.NET Entity Framework is used. In this way the database can be defined during the runtime. This will use our Entity Class RoomReservation which has already defined. Add a new Class Library project to the solution and name it RoomReservationData. Add reference to RoomReservationContracts and EntityFramework Assemblies. EntityFramework needed to be ...