Creating a pure WCF service
In case one is new to WCF, he/she can use this task to become familiar with fundamental WCF concepts. In this task, we will create a simple WCF stock price service host in IIS 7.
How to do it...
Create a IIS Application:
Right-click an IIS Site; we will see the menu shown in the following screenshot:
Then create a
StockPriceService
application.Please remember its folder path. We will create files in this folder in the following steps.
Please also note that the WCFSite should run in .NET Framework 4.0 application pool.
Create WCF code:
Create a new folder named
App_Code
in the application folder. Next, create aStockService.cs
file in theApp_Code
folder. Fill theStockService.cs
file with the following code:using System; using System.ServiceModel; namespace StockPriceService { [ServiceContract] public interface IStockService { [OperationContract] double GetPrice(string ticket); } public class StockService : IStockService { ...