WCF Service
WCF Service project type will create a ASP.NET website. Below is the folder structure of a brand new WCF Service project:
│ Service.svc │ Web.config │ Web.Debug.config │ ├───App_Code │ IService.cs │ Service.cs │ └───App_Data
To host WCF Service, we can just create an application, then point it to the project’s folder.

How the project looks in a browser:
Whenever the service being called, .NET runtime will first check if there’s a change to the source code. If it is changed, the runtime will then compile the website. I found this out by monitoring Temporary ASP.NET Files (which is configurable from web.config):
<system.web> <compilation targetFramework="4.7.2" tempDirectory="D:\projects\wcf\WCFService1\WCFService1_Temp" /> </system.web>
Structure of Temporary ASP.NET Files (D:\projects\wcf\WCFService1\WCFService1_Temp)
└───wcfservice
└───b4011030
└───a40309e8
│ App_Code.compiled
│ App_Code.w2tcshyi.dll
│ preStartInitList.web
│ service.svc.cdcab7d2.compiled
│
├───assembly
│ ├───dl3
│ ├───temp
│ └───tmp
└───hash
hash.web
Simple console program consuming the service:
D:\projects\wcf\WCFService1\WCFService1Client\bin\Debug> WCFService1Client.exe Enter number: 123 You entered: 123 Enter number: 12355 You entered: 12355 Enter number:
To use external library, we can need to create a bin folder, then drop the .dll into it. In this experiment, I use the dll generated from Robert Greiner’s NumberText.
The folder structure after adding the .dll:
│ Service.svc
│ Web.config
│ Web.Debug.config
│
├───App_Code
│ IService.cs
│ Service.cs
│
├───App_Data
└───Bin
NumberText.dll
I also modified Service.cs to utilize the new library:
// .. SNIP ...
using NumberText;
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
public class Service : IService
{
public string GetData(int value)
{
return string.Format("You entered: {0} ( {1} ).", value, value.ToText());
}
// .. SNIP ...
}
The result is shown in the client:
D:\projects\wcf\WCFService1\WCFService1Client\bin\Debug> WCFService1Client.exe Enter number: 19823 You entered: 19823 ( nineteen thousand eight hundred twenty three ). Enter number: 1982 You entered: 1982 ( one thousand nine hundred eighty two ). Enter number: 123 You entered: 123 ( one hundred twenty three ). Enter number: 11 You entered: 11 ( eleven ).
The updated structure of Temporary ASP.NET Files (D:\projects\wcf\WCFService1\WCFService1_Temp):
└───wcfservice
└───b4011030
└───a40309e8
│ App_Code.compiled
│ App_Code.lvuilxx9.dll
│ preStartInitList.web
│ service.svc.cdcab7d2.compiled
│
├───assembly
│ ├───dl3
│ │ └───a1784ffb
│ │ └───24224434_efc1d701
│ │ NumberText.DLL
│ │ __AssemblyInfo__.ini
│ │
│ ├───temp
│ └───tmp
└───hash
hash.web
That’s it for today. Next, I will look into WCF Service Application. Cheers!













